I have not managed to pre-select ListBox items in a dynamically built dialog. While I can check it operates properly using a “static” dialog.
selectItem(…) or selectItemPos(…) seem to behave differently
Am I doing something wrong?
I have not managed to pre-select ListBox items in a dynamically built dialog. While I can check it operates properly using a “static” dialog.
selectItem(…) or selectItemPos(…) seem to behave differently
Am I doing something wrong?
selectItem(…) or selectItemPos(…) seem to behave differently
In what way do they seem to behave differently?
Display the dialog first. Items cannot be selected until the dialog is fully created.
Dim oListCtrl As Object
oListCtrl = _addListBox( Array(COL1,ROW2,WIDTH1,70), default, values, MultiSelect)
DlgControl.setVisible(True) ' show dialog'
oListCtrl.selectItemPos(1, True)
oListCtrl.selectItem("Milan", True)
DlgControl.execute()
Believe this is all that is needed between setVisible & execute:
Dim oListCtrl As Object
oListCtrl = DlgControl.getControl("ListBox")
oListCtrl.selectItemPos(1, True)
oListCtrl.selectItem("Milan", True)
Had problem with each of the lines with oListCtrl
using your code. (Not the Dim statement)
First line got invalid use of object. Other two have extra space before period.
@Ratslinger: Fixed the spaces. As for the error you encountered, the answer doesn’t show it, but I modified _addListBox
to be a function that returns the list control. That way, it only has to be obtained in one place in the code, keeping things neat and tidy.