Try Microsoft Edge
A fast and secure browser that's designed for Windows 10
The case is I need a combobox showing element partially based on selection of another combobox.
I found a solution from google which manage the element by coding, by building combobox in init of form, so I can remove and insert element of combobox in another combobox.selectionChange.
But so far my understanding is to save a combobox value into datatable, the combobox need to be bound.
So how can I save the unbound combobox value? By setting the value into another non-visible control(bound) in form while selectionChange? Or maybe there is another easier way?
You can override modified() method of an unbound ComboBox and there set a form datasource's cursor field value based on the ComboBox selection.
You can also consider using a bounded field for the enum, then:
- create a table which contains one record per available enum value.
- override the lookup() method to select from the new table, the available selections will be filtered base on your other enum field.
If element of Combobox B limited / filtered by selection of Combobox A, using the method both from above(so far i tested GL00MIE modified method)...
Which mean the value of Combobox B must refer to Combobox A, in order to get the real meaning of value, is it?
Combobox A Enum:
Combobox B Enum(In Total):
After the filter, Combobox B Enum will become:
Condition 1(If Combobox A Enum == 0)
Condition 2(If Combobox B Enum == 1)
This is what I seen now, am I correct?
That's right. Note that when you explicitly fill the list of Combobox' values you also have to explicitly convert the selection() value to your enum value (in the example above: 0 for Apple into 2 for Apple and 1 for Orange into 3 for Orange).
I'm not sure about the "explicitly convert the selection() value to your enum value", which method of combobox I should use for this action?
Also in the modified field method I suppose, when you try to assign the unbound combobox value to the record.
Currently the only method I know to set Combobox value is Combobox.Selection(0).
wjgohI'm not sure about the "explicitly convert the selection() value to your enum value", which method of combobox I should use for this action?
Thanks for your help, I found and figure out this just now, so I verified the answer.
Recently I got error on reply in this community.....Sometimes I gave up to reply......
I have a similar requirement as yours, but with a little change in it as below.
I have a combox (in a grid) on a form bounded to an enum with say 10 values in it. Now I want to hide element 6,8 and 9.
The only solution I found for bounded combobox was to delete the element, but than the selection is messed up because if you select the 10 element of the enum you get the wrong value (value 6)
How can I fix this?
You can do what gl00mie suggested.
Unbound the combobox and build the combox values.
Then modify the "modified()" method to handle changes in the combobox. Also be careful of transforming the selection() value to the actual enum value.
I can't change from bound to unbound control as there is some dependency on that.
Please suggest me, if there is any other solution.
I don't know your reason that a control must be bounded. You can always bind a control *manually* using your code. Instead of record buffer value change automatically, you change it using your code when the combobox control is modified. Isn't that the same?
Business Applications communities