Multible Selections from one list - list box and Combo Box

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Multible Selections from one list - list box and Combo Box

Post by kpassaur » Tue Nov 16, 2004 2:20 pm

I would like to make mulible selections from a drop down list. I have always used the list box and I thought that was the difference between list and combo boxes. I checked the help files and the descripiton is about the same. I thought that if you used the Combo box and the user held down the CTRL key multible selections could be made. That does not appear to be the case.

What I am trying to do is read an ini file. If a value is not "0" the item appears in a list that can be selected from. I can do this. However, I want the user to be able to make multible selections from the list. This drop down list would be the preferred method of what I want to accomplish.


Another method that would work would be to use check boxes. However, there are 14 items in the list which means I would have to make 14 different dialog boxes. Dialog box one if one item is greater than 0, dialog box 2 if two items are greater than 0 etc.

Since I don't care about the size the option box I thought that maybe if I assigned a variable to the check box perhaps I could put it in the dialog box.
Such as this

If>option10,writeop1
Let>option1=
Label>writeop1
Let>Option1="CheckBox=msCheckBox2,%Tplate1%,120,40,97,False"
END>writeop1


Dialog>Dialog3
.....
%option1%
EndDialog>Dialog3

This way the dialog box would be built based upon the options. It dosen't work though.

Anyway, any ideas based on not createing 14 dialog boxes?

User avatar
Captive
Macro Veteran
Posts: 213
Joined: Sun Oct 20, 2002 8:37 pm
Location: Colorado, USA

Post by Captive » Wed Nov 17, 2004 12:33 am

Yeah this is possible. In your script, you would create the dialog which would have the combo component something like:

Dialog>Blah
ComboBox=comboFood,40,0,153,List not populated
EndDialog>Blah

Then you can...
Show>Blah

then have your routine that reads the values, and set them, so %myValues% would become something like: Eggs%CRLF%Bacon

And update the dialog combo component with
Let>Blah.comboFood=%myValues%
ResetDialogAction>Blah

It seems that this doesn't currently work, although the documentation says it should (and using an "Edit" component instead of a combo does work).

Marcus - another one for the to-fix list?

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

It least it wasn't me

Post by kpassaur » Wed Nov 17, 2004 8:25 am

Thanks, I thought I was doing something wrong as I couldn't figure out the differences between the Combo and List box.

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Wed Nov 17, 2004 9:18 am

No that sets the selected item index of the combo and is used in non modal dialogs.

You can easily change the list in modal dialogs:

Let>list=1%CRLF%2
Dialog>Dialog1
Caption=Non-Modal Dialog
Top=113
Width=264
Left=16
Height=113
Button=Update,16,8,75,25,5
Button=Exit,16,48,75,25,6
Edit=msEdit1,104,8,121,Fred
ComboBox=msComboBox1,104,32,121,%list%
Edit=msEdit2,104,56,121,
EndDialog>Dialog1

Show>Dialog1,r
Wait>2
Let>list=3%CRLF%4
Show>Dialog1,r

Rather crude example which 2 seconds after you have closed the dialog the first time it changes the list and displays it again with the new list. Obviously you are more likely to make the change within a loop which checks the outcome of other fields on the dialog.
MJT Net Support
[email protected]

User avatar
Captive
Macro Veteran
Posts: 213
Joined: Sun Oct 20, 2002 8:37 pm
Location: Colorado, USA

Post by Captive » Thu Nov 18, 2004 1:47 am

How can I set the list in a combo and listbox of a non-modal dialog?

Something like Let>Blah.mylistbox.items=%blahlist% ?
Obviously not quite because it doesn't work.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu Nov 18, 2004 4:25 am

Did the previous suggestion by support not work?

Where did it fail?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
Captive
Macro Veteran
Posts: 213
Joined: Sun Oct 20, 2002 8:37 pm
Location: Colorado, USA

Post by Captive » Thu Nov 18, 2004 6:03 pm

The suggestion by support was for a modal dialog.

It does not work the same way for a non-modal dialog.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu Nov 18, 2004 7:27 pm

AHA!.....I had not tried the sample script, but saw the caption said
Caption=Non-Modal Dialog
Did not catch that it was modal.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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