Keep 2nd GUI always on top except when another app is active

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
julesverne
Posts: 42
Joined: 18 Apr 2017, 14:39
Contact:

Keep 2nd GUI always on top except when another app is active

13 Nov 2020, 19:00

Hi all,

Have a GUI question which includes some requirements.

The code below shows two GUI's in one script. I'm trying to get the 2nd GUI (toolbarwindow) to always be on top but still allow interaction with the main GUI (parentwindow). Which is what the script below actually does. Here's the catch, if a different window becomes active, along with the usual main window (parentwindow) becoming inactive, the 2nd GUI (toolbarwindow) must also become inactive. The code below does not do that.

Currently that code operates that If you activate another window, only the main window (parentwindow) is inactive, the toolbarwindow stays on top of the active window. Which I don't want. Please HALP!!

EDIT: I would also like to avoid timer
I also have tried #IfWinActive but of course that is only for hotkeys, which won't help me here.

Code:

Code: Select all

Gui, Toolbar: +LastFound +AlwaysOnTop +ToolWindow
Gui, Toolbar: Add, Button, x25 y48, Toolbar`r`nButton
Gui, Add, Button, x25 y48, Parent`r`nButton
Gui, Show, w300 h300, ParentWindow
Gui, Toolbar: Show, w100 h100, ToolbarWindow
User avatar
mikeyww
Posts: 27191
Joined: 09 Sep 2014, 18:38

Re: Keep 2nd GUI always on top except when another app is active

13 Nov 2020, 19:33

Code: Select all

Gui, Toolbar: +LastFound +ToolWindow
Gui, Toolbar: Add, Button, x25 y48, Toolbar`r`nButton
Gui, Parent:Add, Button, x25 y48, Parent`r`nButton
Gui, Parent:Show, w300 h300, ParentWindow
Gui, Toolbar: Show, w100 h100, ToolbarWindow
Gui, Toolbar:+OwnerParent
julesverne
Posts: 42
Joined: 18 Apr 2017, 14:39
Contact:

Re: Keep 2nd GUI always on top except when another app is active

14 Nov 2020, 12:50

YES!! Thank you @mikeyww I shouldn't be surprised though you're like the AHK guru! This is awesome! Thank you so much!! :D :D :D :D :D :D :D :D :bravo: :bravo: :bravo: :bravo: :dance: :dance: :dance: :superhappy: :superhappy: :superhappy: :superhappy:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: pgeugene and 168 guests