Windows in modal mode!

Get help with using AutoHotkey and its commands and hotkeys
User avatar
empardopo
Posts: 336
Joined: 06 Oct 2013, 12:50
Location: Spain
Contact:

Windows in modal mode!

08 Nov 2013, 03:40

Programming by VB I can open a window in modal mode. Is this possible make it with Autohotkey?

I want to do something like this

Image

I have a main window that contains my main menu.
When I select a game or the settings its corresponding windows must open but the main window must be closed.That is, only a window can be opened at the same time.
Any example in this forum?

Thanks in advance.
Everything is possible!
User avatar
joedf
Posts: 7888
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: Windows in modal mode!

09 Nov 2013, 15:09

MDI ??
User avatar
empardopo
Posts: 336
Joined: 06 Oct 2013, 12:50
Location: Spain
Contact:

Re: Windows in modal mode!

09 Nov 2013, 16:56

I dont know what is MDI?
Everything is possible!
User avatar
empardopo
Posts: 336
Joined: 06 Oct 2013, 12:50
Location: Spain
Contact:

Re: Windows in modal mode!

10 Nov 2013, 03:33

Yes, that is. Is it possible to do with Autohotkey?
Or if I select an option, the selected option opens a new window and the main window closes.

Thanks
Everything is possible!
User avatar
PuzzledGreatly
Posts: 1038
Joined: 29 Sep 2013, 22:18

Re: Windows in modal mode!

10 Nov 2013, 10:06

If you are talking about GUI windows then have a look at Gui, +owner and Gui, hide.
User avatar
empardopo
Posts: 336
Joined: 06 Oct 2013, 12:50
Location: Spain
Contact:

Re: Windows in modal mode!

10 Nov 2013, 14:11

Do you know any example to take a look?
Thanks
Everything is possible!
User avatar
PuzzledGreatly
Posts: 1038
Joined: 29 Sep 2013, 22:18

Re: Windows in modal mode!

10 Nov 2013, 21:28

Here's a crude example. Notice that Backplate is set to alwaysontop but the other windows show above it. Window1 hides when Window2 is launched and Winwaitclose pauses the thread until Window2 is hidden. If you want Window1 to be visible at the same time as Window2 then I think you will need to have routines to disable (and later enable) the controls using GuiControl. I don't know about MDI. You could look at GUI +Parent but I managed to crash AHK when I tried that. Hope this helps:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Recommended for catching common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

Gui, 99:-Caption +AlwaysOntop +ToolWindow
Gui, 99:Color, cFFFFCC, white
Gui, 99:show, center w%A_screenwidth% h%A_screenheight%, BackPlate
Gui, 99:maximize,

Gui, 90:-Caption  +ToolWindow +Owner99
Gui, 90:font, s30
Gui, 90:Add, button, gShow80, Show Next Dialogue
Gui, 90:Add, button, gCloseAll, Close The Show
Gui, 90:show, center autoSize, Window1

Gui, 80: +Owner90
Gui, 80:font, s30
Gui, 80:Add, button, gClose80, Close This Dialogue
Gui, 80:Add, button, gCloseAll, Close The Show
Gui, 80:show, hide center autosize, Window2

Return

CloseAll:
	ExitApp
return

Close80:
	Gui, 80:hide
return

Show80:
	Gui, 90:hide
	Gui, 80:Show
	WinWaitActive, Window2 ; wait for Window2 to be active
	WinWaitClose, Window2  ; wait for Window2 to be destroyed
	Gui, 90:show
return

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Ioniq, jacek678, Xeo786, zvit and 52 guests