buildComboboxOptionsList

Help for using specific functions

buildComboboxOptionsList

Postby John Robin Dove » Wed Mar 07, 2018 12:21 pm

Hi Clifton,

I've been struggling with this for a couple of hours and have now found a workaround. But I wonder, should it be as complicated as this?

The problem: in a TB single-select box I use buildComboboxOptionsList to do just that. No problem, the list is created. However if the listbox has a click action, it no longer functions: the lines are not selectable. It seems pretty fussy. It won't even tolerate a variable being defined for the click event. I want the selected line to be put into a variable. I can do this if I use setComboboxOption in a click event in a separate button but this complicates the process for the user. My workaround is to use userProperty and mouseEvents and then use the mouseup event in the single-select box. But is this the best way?
John Robin Dove
 
Posts: 484
Joined: Thu Jan 23, 2014 4:35 am

Re: buildComboboxOptionsList

Postby Clifton » Wed Mar 07, 2018 3:17 pm

To manipulate the comboBox or listBox, you must put your actions on the property change event for the comboBox or listBox.

Example:
    To get the current item selected:
    Image 2.png
    Actions for "on property change" event
    Image 2.png (13.8 KiB) Viewed 7936 times
When you run this example, a message box should pop up after selecting an option in the comboBox with the text of the chosen selection.

NOTE: Please realize that as soon as you use PowerPac functions to manipulate a comboBox or listBox, then some of the default behaviors do not work as expected. The reason for this is because ToolBook hardcodes comboBoxes and thus it does not understand the dynamic changes made to the HTML of the object. Therefore the parameter propertyName is always empty when using actions for on property change. To get information about a comboBox or listBox selection, always use setComboBoxOption() as it is entirely dynamic and more full-featured in that it can get mutliple selections and values assigned to selections. Also, the on select event is non-functional (or never gets sent) when a list is dynamically generated.

Hope this helps!
 
Attachments
comboBoxExample.zip
ToolBook v9.01 file
(34.04 KiB) Downloaded 561 times
Clifton
Site Admin
 
Posts: 731
Joined: Tue Jan 14, 2014 1:04 am

Re: buildComboboxOptionsList

Postby John Robin Dove » Thu Mar 08, 2018 4:11 am

Many thanks once again.
John Robin Dove
 
Posts: 484
Joined: Thu Jan 23, 2014 4:35 am


Return to Function Help

Who is online

Users browsing this forum: No registered users and 1 guest

cron