Dialog ListBox Toggle

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Seezer
Newbie
Posts: 6
Joined: Sun Nov 08, 2009 12:47 am

Dialog ListBox Toggle

Post by Seezer » Sun Nov 15, 2009 4:07 pm

I have seen how you can click 2 or 3 different lines of the listbox, and press a reset button to deselect all of them, but how do you make it toggle select by clicking on it? As long as im posting a new topic I have one more question. Don't laugh at me, but Im not really sure how to tell the script to do what I want it to do with the selected Items in the list box.. Same with a checkbox, does anyone have a script that I can use as an example/reference?

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

Post by JRL » Mon Nov 16, 2009 3:51 pm

If you step through this sample and view the Watch List in the editor, you'll see the dialog variables for the dialog objects. Watch them as they update depending on choices made in the dialog. When you want to use the object's results, you simply use the object's variable. In the sample the variable for the mslabel1 object is reset to the value of the variable for the listbox object.

More or less the same for using the checkbox result. In the watchlist you can see the checkbox object's variable value. It will either be "True" or "False" (I believe this is case sensitive). To use it you simply write code to test the value of the checkbox object variable. If the value is "True" do one thing if it is "False" do something else. In the sample script the value of the variable for the mslabel2 object is changed depending on the status of the checkbox.

Hope this makes sense.


Code: Select all

Dialog>Dialog1
   Caption=Sample
   Width=350
   Height=220
   Top=181
   Left=CENTER
   CheckBox=msCheckBox1,Check Me,21,19,97,False
   ListBox=msListBox1,176,20,121,97,Item1%CRLF%Item2%CRLF%ItemA%CRLF%ItemB,true
   Label=Selection:,176,128
   Label="Check Me" is unchecked,24,56
EndDialog>Dialog1

show>Dialog1

Label>Loop
  GetDialogAction>Dialog1,res1
  If>res1=2
    Exit>0
  EndIf
  If>dialog1.mscheckbox1=True
    Let>dialog1.mslabel2="Check Me" is checked
  Else
    Let>dialog1.mslabel2="Check Me" is unchecked
  EndIf
  Let>dialog1.mslabel1=Selection:%CRLF%%DIALOG1.MSLISTBOX1%
  Wait>0.01
Goto>Loop

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