Hints, tips and tricks for newbies
Moderators: Dorian (MJT support), JRL
-
rullbandspelare
- Pro Scripter
- Posts: 149
- Joined: Tue Mar 23, 2004 9:11 pm
Post
by rullbandspelare » Mon Feb 06, 2017 4:12 pm
Hi!
How can i populate and show a default value in a Dialog dropdown?
I can set the items in the dropdown. But I like to have one of them preselected so that the user can just press OK if they like to use the default selection
Code: Select all
...
Let>DropVal=One%CRLF%Two%CRLF%Three
SetDialogProperty>Dialog1,MSComboBox1,ListText,%DropVal%
Show>Dialog1,res1
GetDialogProperty>Dialog1,MSComboBox1,text,TheSelection
...
Thanks!
-
JRL
- Automation Wizard
- Posts: 3526
- Joined: Mon Jan 10, 2005 6:22 pm
- Location: Iowa
Post
by JRL » Mon Feb 06, 2017 5:11 pm
ItemIndex is zero based. In your example the following would give you "Three" for a "TheSelection" result.
Code: Select all
SetDialogProperty>Dialog1,MSComboBox1,ItemIndex,2
-
Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
-
Contact:
Post
by Marcus Tettmar » Mon Feb 06, 2017 5:16 pm
Use the ItemIndex property to set the selected index. ItemIndex is zero based:
//this sets the selected item to the first in the list.
SetDialogProperty>Dialog1,MSComboBox1,ItemIndex,0
-
JRL
- Automation Wizard
- Posts: 3526
- Joined: Mon Jan 10, 2005 6:22 pm
- Location: Iowa
Post
by JRL » Mon Feb 06, 2017 5:52 pm
At least we gave the same answer this time.