Centering Dialog Boxes

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Dexter1
Pro Scripter
Posts: 64
Joined: Mon Jun 19, 2006 3:28 pm

Centering Dialog Boxes

Post by Dexter1 » Thu Oct 19, 2006 11:00 pm

Is there a way to make a dialog box appear on the center of a screen, regardless of the monitor size? I know I can change the Top and Left numbers to move the dialog box, but that may not always be the center.

Code: Select all

Dialog>Dialog2
   Caption=Ship Short Workflow Installer
   Width=218
   Height=67
   Top=104
   Left=16
   ProgressBar=msProgressBar1,8,8,193,17,0
EndDialog>Dialog2
Show>Dialog2
Thanks,
Josh

Dexter1
Pro Scripter
Posts: 64
Joined: Mon Jun 19, 2006 3:28 pm

Post by Dexter1 » Thu Oct 19, 2006 11:43 pm

Wow, good thing I posted this in the Newbie section! I found the answer on page 50 of the manual.

Code: Select all


Dialog>Dialog2 
Caption=Ship Short Workflow Installer 
Width=218 
Height=67 
Top=Center 
Left=Center
ProgressBar=msProgressBar1,8,8,193,17,0 
EndDialog>Dialog2 
Show>Dialog2

Thanks,
Josh

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Thu Oct 19, 2006 11:44 pm

Well done!

obfusc88
Pro Scripter
Posts: 85
Joined: Wed Mar 14, 2007 6:22 pm

Post by obfusc88 » Thu Mar 15, 2007 6:13 pm

i just tried this to center my Dialog and it did not work for me. it just shows up at top left corner. what am i doing wrong?

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 Mar 15, 2007 6:17 pm

The value of CENTER is Case Sensitive, as shown in the Help file.

This does work:

Code: Select all

Dialog>Dialog2
     Caption=Ship Short Workflow Installer
     Width=218
     Height=67
     Top=CENTER
     Left=CENTER
     ProgressBar=msProgressBar1,8,8,193,17,0
EndDialog>Dialog2

Show>Dialog2 
Experiment:
Try changing Top and Bottom to lowercase "center" one at a time and see that those will translate to "0". If not all UPPERCASE characters, it defaults to zero.
Last edited by Bob Hansen on Thu Mar 15, 2007 7:46 pm, edited 2 times in total.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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

Post by JRL » Thu Mar 15, 2007 6:18 pm

CENTER needs to be capitalized.

Dialog>Dialog2
Caption=Ship Short Workflow Installer
Width=218
Height=67
Top=
CENTER
Left=CENTER
ProgressBar=msProgressBar1,8,8,193,17,0
EndDialog>Dialog2
Show>Dialog2

obfusc88
Pro Scripter
Posts: 85
Joined: Wed Mar 14, 2007 6:22 pm

Post by obfusc88 » Thu Mar 15, 2007 10:46 pm

thank you to bob hansen and to jrl for the speedy answer. and you both have the same answer too. i have just made the changes in a Dialog that jrl created for me. it is all coming together. great help, thank you again.

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