Build Dialog on Conditions

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

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

Build Dialog on Conditions

Post by kpassaur » Tue Apr 07, 2009 7:05 pm

I have a dialog with six Edit boxes and Labels that I may or may not want displayed depening upon conditions.

With the labels it is easy I can place a space in them and they are hidden. I cannot seem to figure out a way to elmininate the Edit box. (I saw the post about moving them out of the way - but I am not displaying and hiding them, I dont' need them at all.

If someone could post an easy example if it can be done, that would be very helpful.

My alternative is to create six different dialogs and place them in six subroutines and load the dialog by calling the subroutine. The downside is that when I want to make a change I have to edit all six boxes.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Apr 07, 2009 7:19 pm

Use SetDialogObjectVisible
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

ainterne
Junior Coder
Posts: 29
Joined: Tue Jun 05, 2007 4:03 am

Post by ainterne » Wed Apr 08, 2009 3:52 am

Here are a couple of examples. Try using this and then setting the 0 and the end to 1 and run it again. So basically you can use multiple lines like this just before the "Show>Dialog1,s"
SetDialogObjectVisible>Dialog1,msCheckBox4,0

This makes the Object visible or not rather than leaves it visible but stops it being used.

In the second example you can change the 0 to 1 at the end of the
LibFunc and make the checkbox unusable but still visable.

Hope these help.

Code: Select all


Dialog>Dialog1
   Caption=Control Events Panel
   Width=391
   Height=385
   Top=220
   Left=501
   Max=1
   Min=1
   Close=1
   Resize=1
   CheckBox=msCheckBox1,Connect to remote server.,96,72,179,True
   CheckBox=msCheckBox3,Transfer Files to remote server.,96,128,218,False
   CheckBox=msCheckBox5,Restart Services on remote server.,96,192,191,False
   CheckBox=msCheckBox6,Diconnect from remote server.,96,224,185,True
   Label=Process options,64,32,true
   CheckBox=msCheckBox4,Backout to original files on remote server.,97,159,192,False
   Button=Go,96,256,75,25,1
   Button=Cancel,208,256,75,25,2
   CheckBox=msCheckBox2,Backup current files before transfer.,98,99,207,True
EndDialog>Dialog1
SetDialogObjectVisible>Dialog1,msCheckBox4,0

Show>Dialog1,s

Code: Select all


Dialog>Dialog1
   Caption=Control Events Panel
   Width=391
   Height=385
   Top=220
   Left=501
   Max=1
   Min=1
   Close=1
   Resize=1
   CheckBox=msCheckBox1,Connect to remote server.,96,72,179,True
   CheckBox=msCheckBox3,Transfer Files to remote server.,96,128,218,False
   CheckBox=msCheckBox5,Restart Services on remote server.,96,192,191,False
   CheckBox=msCheckBox6,Diconnect from remote server.,96,224,185,True
   Label=Process options,64,32,true
   CheckBox=msCheckBox4,Backout to original files on remote server.,97,159,192,False
   Button=Go,96,256,75,25,1
   Button=Cancel,208,256,75,25,2
   CheckBox=msCheckBox2,Backup current files before transfer.,98,99,207,True
EndDialog>Dialog1
LibFunc>user32,EnableWindow,lfres,Dialog1.msCheckBox4.HANDLE,0
LibFunc>user32,EnableWindow,lfres,Dialog1.msCheckBox3.HANDLE,0
LibFunc>user32,EnableWindow,lfres,Dialog1.msCheckBox5.HANDLE,0

Show>Dialog1,r
Phil.......

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

Hide on Dialog

Post by kpassaur » Tue Apr 21, 2009 7:54 pm

Thanks,

These are fantastic examples! I finished before I was this and ended up tons of code this would have avoided.

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