Keeping a Gui open until OK is pressed

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
roysubs
Posts: 426
Joined: 29 Sep 2018, 16:37

Keeping a Gui open until OK is pressed

20 Nov 2018, 11:55

I think I've been approaching my problem with Gui wrongly ...

I'm using two Gui's, one that calls another, but as was pointed out to me, 2x Gui's can't be on screen at same time(??), so when my second Gui is called from the first, and then returns to reopen the first, that act kills the second Gui (is that right?).

I'm just a bit unclear on the best way around this. I think I need an OK button on the second Gui (which is the code below) and for that Gui to wait for the user to hit OK before continuing the workflow?

So my question is (really probably a very simple one): with the below Gui control setup, what should I add to include a simple OK button and then get the control to *wait* until that OK button is pressed? (i.e. in the same way that a standard MsgBox stops flow until it is dismissed).

imagepath = C:\0\fp001.png
Gui, +Resize
Gui, Add, Pic, xm vPic
Gui, Show
if imagepath =
return
Height := A_ScreenHeight - 200
Width := -1 ; -1 is "Keep aspect ratio"
GuiControl, , Pic, *w%width% *h%height% %imagepath% ; Load the image.
Gui, Add, Button, xm w80 Default, &OK
Gui, Add, Button, x+m wp, &Cancel
Gui, Show, x5 y5 AutoSize, %imagepath% ; Resize the window to match the picture size. ; xCenter puts in middle screen!
WinWaitClose
Shade4Real
Posts: 16
Joined: 16 Jun 2018, 00:54

Re: Keeping a Gui open until OK is pressed

21 Nov 2018, 01:38

I believe you can have more than one gui open by labeling them
for example

Code: Select all

#persistent
#Singleinstance, force
Gui, 1:New,, Gui One
Gui, 2:New,, Gui Two
Gui, 1:Show, x200 y200 h300 w500
Gui, 2:Show, x600 y300 h300 w500
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: cjsmile999, Google [Bot] and 363 guests