can someone explain to me the difference between a Modal Dialog and a Non-Modal Dialog? I have been trying to figure out which one to use and I am kinda confused. Below is my sample script to see what I am doing. btw everything is working correctly (still in develpopment) would just like to know if any of you could give any pointers if there is something better I can do in my script
Dialog>Dialog1
Caption=WantedMan's Macro
Top=279
Width=450
Left=743
Height=370
Label=What color are we looking for?,40,160
Label=Enter X Start,56,8
Label=Enter X End,136,8
Label=Enter Y Start,56,56
Label=Enter Y End,136,56
Label=Check Color Once Every,80,120
Label=Pixels,240,120
Label=Enter X & Y for Fishing Icon,224,8
Edit=XStart,56,24,49,
Edit=XEnd,136,24,49,
Edit=XFishIcon,224,24,49,150
Edit=YFishIcon,304,24,49,775
Edit=YStart,56,72,49,
Edit=YEnd,136,72,49,
Edit=LootWindowX,224,72,49,150
Edit=LootWindowY,304,72,49,160
Edit=PixelNumber,208,120,25,1
Edit=WhatColor,192,160,121,
CheckBox=Repeat,Do you want this macro to Repeat?,136,280,193,False
Button=Cancel,288,304,75,25,666
Button=Run Macro,96,304,75,25,1
ComboBox=OperBox,184,200,121,=%CRLF%%CRLF%%CRLF%
Memo=msMemo1,304,200,97,65,= Equals Not Equal > Greater than Dialog1
Label>ActionLoop
Show>Dialog1,result
if>result=1,Run
if>result=666,exit
if>Dialog1.Repeat=True,RepeatYES
Goto>ActionLoop
SRT>Run
Let>xend=%Dialog1.YEnd%
Let>yend=%Dialog1.XEnd%
Let>x=%Dialog1.XStart%
Repeat>x
Let>x=x+%Dialog1.PixelNumber%
Let>y=%Dialog1.YStart%
Repeat>y
Let>y=y+%Dialog1.PixelNumber%
GetPixelColor>x,y,LFB
If>LFBy,yend
Until>x,xend
MessageModal>Did NOT Find Anything
END>Run
Label>FOUND_IT
MouseMove>%x%,%y%
MessageModal>Found at %x%,%y%
END>Run
SRT>RepeatYES
MessageModal>%Dialog1.TopLeft%%Dialog1.TopRight%
Wait>20
Message>it is repeating
END>RepeatYES
Label>exit
Modal VS Non-Modal
Moderators: JRL, Dorian (MJT support)
From dictionary.com (http://dictionary.reference.com/search?q=modal):
In MS Windows programming, A window with the label
"WS_MODAL" will stay on the screen and claim all the
user-input. Other windows can only be accessed if the MODAL
window is closed. Such a window would typically be used for
an error dialog box to warn the user for something
important, like "Critical error, shut down the system and
restart".
So, when you show a modal dialog input is confined to that dialog and script exucution halts until you close it. When you show a non-modal dialog script execution continues even after you've "show"ed the form, other dialogs and forms can be displayed and the user can click anywhere they like.
A modal dialog is therefore easier to control. You show it and then you have to do no more processing until it is closed. Processing then continues and you can determine what button the user pressed. With a non-modal dialog if you want to determine which button has been pressed and what the values of the fields are you would need a loop after it has been displayed which constantly checks the outcome and determines what to do. The benefit is that the form stays on the screen while the processing takes place.
You have to decide which kind of dialog is most appropriate for your needs. If you just want to ask the user some questions and then go off and do the work based on the answers a modal dialog is all you usually need. If the form should stay present and you will be passing data back and forth and interracting with the user until they decide to close the form (like a typical Windows application) you would need a non-modal dialog.
Hope this helps.
In MS Windows programming, A window with the label
"WS_MODAL" will stay on the screen and claim all the
user-input. Other windows can only be accessed if the MODAL
window is closed. Such a window would typically be used for
an error dialog box to warn the user for something
important, like "Critical error, shut down the system and
restart".
So, when you show a modal dialog input is confined to that dialog and script exucution halts until you close it. When you show a non-modal dialog script execution continues even after you've "show"ed the form, other dialogs and forms can be displayed and the user can click anywhere they like.
A modal dialog is therefore easier to control. You show it and then you have to do no more processing until it is closed. Processing then continues and you can determine what button the user pressed. With a non-modal dialog if you want to determine which button has been pressed and what the values of the fields are you would need a loop after it has been displayed which constantly checks the outcome and determines what to do. The benefit is that the form stays on the screen while the processing takes place.
You have to decide which kind of dialog is most appropriate for your needs. If you just want to ask the user some questions and then go off and do the work based on the answers a modal dialog is all you usually need. If the form should stay present and you will be passing data back and forth and interracting with the user until they decide to close the form (like a typical Windows application) you would need a non-modal dialog.
Hope this helps.
MJT Net Support
[email protected]
[email protected]