Jump to content
Sign in to follow this  
Zachlr

How can I run more than one GUI at a time?

Recommended Posts

Zachlr

I know this is a dumb question, but how can I run more than one GUI at one time, since GUIGetMsg() cannot capture events from a specific GUI. What I mean is, if there are two GUIs open, GUIGetMsg() cannot distinguish which GUI sent $GUI_EVENT_CLOSE, $GUI_EVENT_MINIMIZE, or what have you. I am working on a somewhat large program, which will need too have more than one GUI open at times. Currently, when the main GUI is closed, instead of exiting, the program will hide the window. The problem is, I don't know how to tell the script to only do that for the main GUI, and GUIDelete() for the other windows. I am running a Msg Loop script if it makes a difference, but I can convert to OnEvent if I have to. I have divided my script into smaller scripts, each one has a GUI. I was going to #include them but I just realized that the script will get stuck in the first Msg Loop, so I'll probably put them all in one Msg Loop, or make them OnEvent. But if I put them all in one script in a Msg Loop then the GUIGetMsg() won't be able to distinguish between the GUIs which is the whole point of this post. /ramble.

$SomeGUI = GUICreate("Some GUI", "Some Parameters")
$SomeOtherGUI = GUICreate("Some other GUI", "Some Parameters")

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
MsgBox(0, "", "Hmm...  I'm not sure which GUI closed, so I don't know what to do.")
EndSwitch
Wend

Perhaps I could use an If not WinExists("Some GUI", "") thing, but it seems like there should be a better way.

Share this post


Link to post
Share on other sites
martin

I know this is a dumb question, but how can I run more than one GUI at one time, since GUIGetMsg() cannot capture events from a specific GUI. What I mean is, if there are two GUIs open, GUIGetMsg() cannot distinguish which GUI sent $GUI_EVENT_CLOSE, $GUI_EVENT_MINIMIZE, or what have you. I am working on a somewhat large program, which will need too have more than one GUI open at times. Currently, when the main GUI is closed, instead of exiting, the program will hide the window. The problem is, I don't know how to tell the script to only do that for the main GUI, and GUIDelete() for the other windows. I am running a Msg Loop script if it makes a difference, but I can convert to OnEvent if I have to. I have divided my script into smaller scripts, each one has a GUI. I was going to #include them but I just realized that the script will get stuck in the first Msg Loop, so I'll probably put them all in one Msg Loop, or make them OnEvent. But if I put them all in one script in a Msg Loop then the GUIGetMsg() won't be able to distinguish between the GUIs which is the whole point of this post. /ramble.

$SomeGUI = GUICreate("Some GUI", "Some Parameters")
$SomeOtherGUI = GUICreate("Some other GUI", "Some Parameters")

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
MsgBox(0, "", "Hmm...  I'm not sure which GUI closed, so I don't know what to do.")
EndSwitch
Wend

Perhaps I could use an If not WinExists("Some GUI", "") thing, but it seems like there should be a better way.

Look in the help for GuiGetMsg and using the advanced parameter. Then you can see which Gui sent the message.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
Zachlr

fhdgfebfndsndasbbusfhdsfhjo3i8y9f8yds9hubr3 fdf09w (that was me banging my head on the keyboard) DOH!

Well that was an obvious one, heh heh. I never looked at it in the help file, in fact I didn't know it even had a parameter. Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.