Hello @ all,
i want to print the label text from two ComboBoxes as a simple FXLabel. If the user changes the items in ComboBoxes, the string in the FXLabel needs to be updated, to show the newly selected items.
I have really no idea, how this can be done. Can anyone help me with this?
Kind Regards
Stephan
Unfortunately, the *.py-File cannot be attached here, so i provide the according code-snippet:
ComboBox_1 = AFXComboBox(p=self, ncols=0, nvis=1, text='Box1', tgt=form.keyword01Kw, sel=0)
ComboBox_1.setMaxVisible(10) ComboBox_1.appendItem(text='Item 1')
ComboBox_1.appendItem(text='Item 2')
ComboBox_1.appendItem(text='Item 3')
ComboBox_2 = AFXComboBox(p=self, ncols=0, nvis=1, text='Box2', tgt=form.keyword03Kw, sel=0)
ComboBox_2.setMaxVisible(10) ComboBox_2.appendItem(text='Item 1')
ComboBox_2.appendItem(text='Item 2')
ComboBox_2.appendItem(text='Item 3')
#
# print the selected items from the ComboBoxes
currentItem_1 = ComboBox_1.getCurrentItem()
currentItemText_1 = ComboBox_1.getItemText(currentItem_1)
currentItem_2 = ComboBox_2.getCurrentItem()
currentItemText_2 = ComboBox_2.getItemText(currentItem_2)
fxLabelString = currentItemText_1 + ' ' + currentItemText_1 # read the currently selected items and assemble to a string
FXLabel(p=self, text=fxLabelString, opts=JUSTIFY_LEFT) # print the string as FXLabel
#
# Question: How can fxLabelString be updated, if the user changes the items in the ComboBoxes?