I’m using my code in this post to make changes to the drop down menu component’s DataSetComboBoxModel and NewPMIComboBoxRenderer classes, however it’s always had the issue where the component will show <Select One> when the DataSetComboBoxModel is replaced. I can work around this by getting the selected item prior to replacing the model, then after replacing it, writing it back to it, but I wonder how I can do this within the class itself?
The section of interest is this:
class NewPMIComboBoxModel(DataSetComboBoxModel):
def __init__(self, target):
DataSetComboBoxModel.__init__(self, target, target.data)
self.target = target
As soon as I run the below, the drop down selection will be lost and <Select One> will display:
RC = system.gui.getParentWindow(event).rootContainer
PMIComboBox = RC.getComponent("Dropdown")
PMIComboBox.setModel(NewPMIComboBoxModel(PMIComboBox))
How can I maintain the selection?
Cheers
