I have a main window screen that has several fields. When user double-clicks one of the fields then a pop-up window with a drop-down selection should be shown. I would pass the value of the field to the pop-up selection window and user can then select from the drop-down and the selected value should be sent back to the main screen. Somehow the value returned to the main screen has been incorrect; It shows a value that is not even in the selection list.
I hope I can get some help here. Thank you in advance!
Below are my codes (Related sections only)
Main screen
Define_Com Class(#Dropdown_Selection_PopUp) Name(#Dropdown_Selection_PopUp)
Evtroutine Handling(#GroupCode.DoubleClick)
#Dropdown_Selection_PopUp.uExecute Parm1(#GroupCode)
Endroutine
Evtroutine Handling(#Dropdown_Selection_PopUp.uConfirmClicked)
#Dropdown_Selection_PopUp.ClosePopup
Endroutine
Pop-Up window
Define_Evt Name(uExecute)
Define_Evt Name(uConfirmClicked)
Define_Evt Name(uClosePopUp)
* Dropdown List
Define_Com Class(#PRIM_LIST.DropDown) Name(#GroupCodeSelectionList) Columnheaderheight(0) Columnlines(False) Displayposition(2) Left(24) Parent(#Panel2) Rowlines(False) Tabposition(2) Top(64) Width(417) Height(25)
Define_Com Class(#PRIM_LIST.String) Name(#GRCD) Columnunits(Proportion) Columnwidth(10) Displayposition(1) Parent(#GroupCodeSelectionList) Source(#GRCD) Sortposition(1)
Define_Com Class(#PRIM_LIST.String) Name(#GRNM) Columnunits(Proportion) Columnwidth(50) Displayposition(3) Parent(#GroupCode1SelectionList) Source(#GRNM)
Mthroutine Name(uExecute)
Define_Map For(*BOTH) Class(#Parm1) Name(#GroupCode)
*Codes for generating the selection list
Endroutine
Evtroutine Handling(#ConfirmButton.Click)
#GroupCode := #GRCD
Signal Event(uConfirmClicked)
Signal Event(uClosePopUp)
Endroutine
Here are some points that I have verified:
• The parameter passed correctly from the main screen to the pop-up window
• The drop-down list shows the correct selected item based on the parameter passed
• The value selected from the list is correct; #GRCD is showing the correct value just before the pop-up window signals the uConfrmClicked
• The value received back in the main screen is incorrect
VL_ONE Pop-Up window: Receiving back a value from a pop-up window
-
alphabeta13
- Posts: 21
- Joined: Tue Jan 14, 2020 12:18 am
Re: VL_ONE Pop-Up window: Receiving back a value from a pop-up window
I think the uExecute routine has finished before the uConfirmClicked event occurs. So the value passed back is not the value from the selected list item.
Would it be possible to add a parameter to the uConfirmClicked event, and pass back the value as that parameter when signalling uConfirmClicked?
Would it be possible to add a parameter to the uConfirmClicked event, and pass back the value as that parameter when signalling uConfirmClicked?
Re: VL_ONE Pop-Up window: Receiving back a value from a pop-up window
Try this little change, using a command handler and a dialog (and a parameter in the event as Mark suggested)
Code for the command handler:
Code for the Dialog:
Code for the command handler:
Code: Select all
Function Options(*Direct)
Begin_Com Role(*EXTENDS #VF_AC010O) LayoutManager(*NULL) Width(513) Height(313)
Define_Com Class(#PRIM_MD.Edit) Name(#Edit) Caption('Caption') DisplayPosition(1) Left(45) Parent(#COM_OWNER) TabPosition(1) Top(40)
Define_Com Class(#PRIM_MD.RaisedButton) Name(#Button) Caption('SENT THE VALUE') DisplayPosition(2) Left(48) Parent(#COM_OWNER) TabPosition(2) ThemeDrawStyle('MediumSuccess') Top(112) Width(181)
Define_Com Class(#test0225DL) Name(#TEST0225DL)
Evtroutine Handling(#Button.Click)
#test0225DL.uExecute EmpnoReceived(#Edit.Value)
#test0225DL.Show
Endroutine
Evtroutine Handling(#test0225DL.uConfirmClicked) EMPNO(#EMPNO)
#Edit.Value := #EMPNO
#test0225DL.Close
Endroutine
End_Com
Code: Select all
Begin_Com Role(*EXTENDS #PRIM_DLG) Width(337)
* Dropdown List
Define_Com Class(#PRIM_LIST.DropDown) Name(#GroupCodeSelectionList) ColumnHeaderHeight(0) ColumnLines(False) DisplayPosition(1) Left(24) Parent(#COM_OWNER) RowLines(False) TabPosition(1) Top(24) Width(281) Height(25)
Define_Com Class(#PRIM_LIST.String) Name(#TXTEMPNO) ColumnUnits(Proportion) ColumnWidth(10) DisplayPosition(1) Parent(#GroupCodeSelectionList) Source(#EMPNO) SortPosition(1)
Define_Com Class(#PRIM_LIST.String) Name(#TXTSURNAME) ColumnUnits(Proportion) ColumnWidth(50) DisplayPosition(2) Parent(#GroupCodeSelectionList) Source(#SURNAME)
Define_Com Class(#PRIM_MD.RaisedButton) Name(#ConfirmButton) Caption('CONFIRM') DisplayPosition(2) Left(24) Parent(#COM_OWNER) TabPosition(2) ThemeDrawStyle('MediumAccent') Top(72)
* Returns the EMPNO when the event is triggered... is input for the event
Define_Evt Name(uConfirmClicked)
Define_Map For(*Input) Class(#EMPNO)
Mthroutine Name(uExecute)
Define_Map For(*Input) Class(#EMPNO) Name(#EmpnoReceived)
* Load the drop Down
Clr_List Named(#GroupCodeSelectionList)
#EMPNO := "A1111"
#SURNAME := "AAAAAAAAAAA"
Add_Entry To_List(#GroupCodeSelectionList)
#EMPNO := "A2222"
#SURNAME := "BBBBBBBBBBBBB"
Add_Entry To_List(#GroupCodeSelectionList)
#EMPNO := "A3333"
#SURNAME := "CCCCCCC"
Add_Entry To_List(#GroupCodeSelectionList)
* Positionate in the value received
Loc_Entry In_List(#GroupCodeSelectionList) Where(#EMPNO = #EmpnoReceived)
#GroupCodeSelectionList.CurrentItem.Focus := True
Endroutine
Evtroutine Handling(#ConfirmButton.Click)
Signal Event(uConfirmClicked) EMPNO(#EMPNO)
Endroutine
End_Com
-
alphabeta13
- Posts: 21
- Joined: Tue Jan 14, 2020 12:18 am
Re: VL_ONE Pop-Up window: Receiving back a value from a pop-up window
Sorry for the late response as I was caught up with other assignments.
I have made the changes following the suggestion, and it is now working fine.
Thank you very much!
I have made the changes following the suggestion, and it is now working fine.
Thank you very much!