GetDialogProperty from ListBox or ComboBox

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Jamball77
Newbie
Posts: 14
Joined: Tue Aug 11, 2015 2:25 pm

GetDialogProperty from ListBox or ComboBox

Post by Jamball77 » Wed Sep 09, 2015 9:58 pm

I have a form with both "Edit" and "ListBoxes"

I can see the values for each type update in the watchlist as I step through my code.

Problem
Values from Edit Text properties are fetched properly using GetDialogProperty
but values from ListBoxe Text properties fetch the entire list of entries in the Listbox Text field.
watchlist.jpg
[snippet=]This is the "Dialog" code for MSListbox2:

object MSListBox2: tMSListBox
Left = 216
Top = 243
Width = 121
Height = 70
Style = lbOwnerDrawFixed
ItemHeight = 20
Items.Strings = (
''
'GREEN_TAG'
'RED_TAG')
TabOrder = 12
Text = #13#10'GREEN_TAG'#13#10'RED_TAG'#13#10
SelectedIndex = -1
end
[/snippet]

I'm expecting to get either a blank field, or "GREEN_TAG", or "RED_TAG". What I get is "GREEN_TAGRED_TAG".

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: GetDialogProperty from ListBox or ComboBox

Post by JRL » Thu Sep 10, 2015 1:30 am

To acquire the selected list item,use:

Code: Select all

GetDialogProperty>Dialog1,MSListBox3,SelectedItems,vTag

Jamball77
Newbie
Posts: 14
Joined: Tue Aug 11, 2015 2:25 pm

Re: GetDialogProperty from ListBox or ComboBox

Post by Jamball77 » Thu Sep 10, 2015 2:02 pm

I love it when it works :D

So big picture is that you just have to find the right Property you want returned.

Edit Box: Text
ListBox: SelectedItems
Check Box: State
ComboBox: :?:

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: GetDialogProperty from ListBox or ComboBox

Post by JRL » Thu Sep 10, 2015 2:29 pm

Edit Box: Text
ListBox: SelectedItems
Check Box: State
ComboBox: Text

If you allowed the sample scripts when you installed Macro Scheduler, look in the "General" folder for ComboBox_Sample.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts