VL V15 Form: the method of firing an event only when the content of the combo box is changed manually.
Posted: Thu Mar 17, 2022 4:21 pm
Hi All,
I would like to fire the event only when user manually changes the contents of the combo box from the screen. I've tried using the ComboChanged event, but the ComboChanged event also fires when the records are programmatically added to the combobox in an initialize process.
Should I use the traditional method of flag? Does anyone know a good way?
Thank you.
Best regards,
Rieko Saitoh
I would like to fire the event only when user manually changes the contents of the combo box from the screen. I've tried using the ComboChanged event, but the ComboChanged event also fires when the records are programmatically added to the combobox in an initialize process.
Code: Select all
Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM) Clientwidth(484) Clientheight(300) Left(482) Top(215) Height(338) Width(499)
Define_Com Class(#PRIM_CMBX) Name(#ComboBox1) Componentversion(1) Displayposition(1) Fixedheight(False) Left(70) Parent(#COM_OWNER) Showselection(False) Showselectionhilight(False) Tabposition(1) Top(24) Comboboxstyle(DropDownList) Height(37) Width(163) Modifiedrules(IgnoreFocusChanges+IgnoreSelectionChanges)
Define_Com Class(#PRIM_CBCL) Name(#CBCL1) Displayposition(1) Parent(#ComboBox1) Source(#STD_TEXT) Usepicklist(False)
Define_Com Class(#PRIM_CBCL) Name(#CBCL2) Parent(#ComboBox1) Source(#STD_NUM) Usepicklist(False) Visible(False)
Evtroutine Handling(#com_owner.Initialize)
Set Com(#com_owner) Caption(*component_desc)
Endroutine
Evtroutine Handling(#COM_OWNER.CreateInstance)
Clr_List Named(#ComboBox1)
#STD_NUM := 1
#STD_TEXT := 'AAA'
Add_Entry To_List(#ComboBox1)
#STD_NUM := 2
#STD_TEXT := 'BBB'
Add_Entry To_List(#ComboBox1)
#STD_NUM := 3
#STD_TEXT := 'CCC'
Add_Entry To_List(#ComboBox1)
Get_Entry Number(1) From_List(#ComboBox1)
Set Com(#ComboBox1.CurrentItem) Selected(True) Focus(True)
Endroutine
Evtroutine Handling(#ComboBox1.ComboChanged)
Use Builtin(MESSAGE_BOX_SHOW) With_Args(*Default *Default *Default *Default 'ComboChanged')
Endroutine
End_Com
Should I use the traditional method of flag? Does anyone know a good way?
Thank you.
Best regards,
Rieko Saitoh