Dialog Box will not re-open

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Snickers
Macro Veteran
Posts: 151
Joined: Thu Dec 09, 2004 3:01 pm
Location: Somewhere in TX

Dialog Box will not re-open

Post by Snickers » Fri Aug 03, 2007 5:13 pm

Label>Start

Dialog>Setup
Caption=Setup
Width=491
Height=464
Top=CENTER
Left=CENTER
Max=0
Min=0
Close=0
Resize=0
ComboBox=com1,64,112,97,Item1%CRLF%Item2%CRLF%Item3
ComboBox=com2,64,136,97,Item1%CRLF%Item2%CRLF%Item3
ComboBox=com3,64,160,97,Item1%CRLF%Item2%CRLF%Item3
ComboBox=com4,64,184,97,Item1%CRLF%Item2%CRLF%Item3
ComboBox=com5,64,208,97,Item1%CRLF%Item2%CRLF%Item3
ComboBox=com6,64,232,97,Item1%CRLF%Item2%CRLF%Item3
ComboBox=com7,64,256,97,Item1%CRLF%Item2%CRLF%Item3%CRLF%Item4
ComboBox=com8,64,280,97,Item1%CRLF%Item2%CRLF%Item3%CRLF%Item4
ComboBox=com9,64,304,97,Item1%CRLF%Item2%CRLF%Item3%CRLF%Item4
ComboBox=com0,64,328,97,Item1%CRLF%Item2%CRLF%Item3%CRLF%Item4
ComboBox=com00,64,352,97,Item1%CRLF%Item2%CRLF%Item3%CRLF%Item5%CRLF%Item7
ComboBox=com000,64,376,97,Item1%CRLF%Item2%CRLF%Item3%CRLF%Item6%CRLF%Item8
Button=Done!,50,400,75,25,2
EndDialog>Setup

Show>Setup

Label>MainLoop
GetDialogAction>Setup,result
If>result=2
CloseDialog>Setup
Goto>Check2
Endif
Goto>MainLoop

Label>Check2
MessageModal>You have reached Check2 next you will be sent to start and an error will occur.
Goto>Start



If you copy and paste the above, you will get the same error as me.
at some point in this stage, if the user makes an error, it will send the script back to Goto>Start. It will load the dialog the first time through; however, it isn't loading it the second time once an error has occurred.

Is there a way to make the dialog reset so that it will re-open in the event it is sent to it?


I get a Macro Scheduler Error message: Error trying to create Dialog. This error only occurs the second time through.

Snickers
Macro Veteran
Posts: 151
Joined: Thu Dec 09, 2004 3:01 pm
Location: Somewhere in TX

Post by Snickers » Fri Aug 03, 2007 5:44 pm

Found it! If you want to display your dialog box again, make sure that the dialog is created prior to your Label>Start.

For Example:


Dialog>Setup
Caption=Setup
Width=491
Height=464
Top=CENTER
Left=CENTER
Max=0
Min=0
Close=0
Resize=0
ComboBox=com1,64,112,97,Item1%CRLF%Item2%CRLF%Item3
ComboBox=com2,64,136,97,Item1%CRLF%Item2%CRLF%Item3
ComboBox=com3,64,160,97,Item1%CRLF%Item2%CRLF%Item3
ComboBox=com4,64,184,97,Item1%CRLF%Item2%CRLF%Item3
ComboBox=com5,64,208,97,Item1%CRLF%Item2%CRLF%Item3
ComboBox=com6,64,232,97,Item1%CRLF%Item2%CRLF%Item3
ComboBox=com7,64,256,97,Item1%CRLF%Item2%CRLF%Item3%CRLF%Item4
ComboBox=com8,64,280,97,Item1%CRLF%Item2%CRLF%Item3%CRLF%Item4
ComboBox=com9,64,304,97,Item1%CRLF%Item2%CRLF%Item3%CRLF%Item4
ComboBox=com0,64,328,97,Item1%CRLF%Item2%CRLF%Item3%CRLF%Item4
ComboBox=com00,64,352,97,Item1%CRLF%Item2%CRLF%Item3%CRLF%Item5%CRLF%Item7
ComboBox=com000,64,376,97,Item1%CRLF%Item2%CRLF%Item3%CRLF%Item6%CRLF%Item8
Button=Done!,50,400,75,25,2
EndDialog>Setup

Label>Start

Show>Setup

Label>MainLoop
GetDialogAction>Setup,result
If>result=2
CloseDialog>Setup
Goto>Check2
Endif
Goto>MainLoop

Label>Check2
MessageModal>You have reached Check2 next you will be sent to start and an error will occur.
Goto>Start



The error came because it kept trying to recreate the Dialog instead of merely show it.

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

Post by Marcus Tettmar » Sun Aug 05, 2007 9:31 am

Dialogs, as with anything in life, can only be created once. Once something is created you can SHOW it many times, but try to create it again, when it already exists and you have not just a philosophical conundrum but will also upset the computer.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

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