Dropdown Selections By Code - Forum

Forum Navigation
You need to log in to create posts and topics.

Dropdown Selections By Code

I've been trying to figure out how to select one item in a drop down list, programmatically.   How might this be done?

Thanks

rcohen

Hello,

I assume you mean a combobox?

SetVar "[ComboBox3]" "1"

Or

SetVar "[ComboBox3]" "MyFirstItem"

Depending on what you choose as content-variable.

Regards

Hans-Peter

 

luishp and rcohen have reacted to this post.
luishprcohen

Hi Hans.

The variable is already set, as I just added that element to this list via code.   The variable is correct, but yet the physical position on the combobox doesn't follow.   And so that's why I'm asking this.  How do I set the physical (visual) selection on this combobox so that the user knows the variable is set to that?

Thanks

Hello,

Have you checked your property dialog:

Variables contains:

item number (1,2,3,...)

item text

What have you set?

When set to number: SetVar "[YourVar]" "1"

Should highlight the first entry.

When set to item text: SetVar "[YourVar]" "YourFirstText"

Should also highlight the first entry.

Regards

Hans-Peter

Vadim has reacted to this post.
Vadim

Hans, I must apologize, but sometimes I do not get notifications that I have a reply...

The problem turned out to be a syntax issue, and once corrected, it worked as expected ;-0

Thank you sir.   Your time is greatly appreciated.

rcohen

Hans, I must apologize, but sometimes I do not get notifications that I have a reply...

@rcohen note the small link under every forum topic to subscribe otherwise you will not get a notification if you have not been mentioned.

Regards.