AutoHotkey Community

It is currently May 27th, 2012, 8:18 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: January 25th, 2012, 2:16 pm 
Offline

Joined: August 15th, 2009, 7:20 am
Posts: 308
I have 2 GUIs. I use a timer to keep their position relative to a the application they act as buttons for. I know how to hide the GUIs if the application window is minimised and show them again if it is restored but my problem is if another window is moved on top of the application. At that point I need to hide the GUIs and then restore them again if the application goes on top again. How can I test to see if a particular window is covered by another or not? Thanks,

GP


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 25th, 2012, 3:20 pm 
Offline

Joined: July 10th, 2008, 8:49 am
Posts: 1865
Location: Brussels, Belgium
Do you know it's a reaaaaaally easy question ???

Don't you know "IfWinActive" or "WinGetActiveTitle" ??? o_O

Code:
SetTimer AutoHide, 100

AutoHide:
IfWinNotActive TargetWindow
    WinHide MyGui
Else
    WinShowMyGui
Return

Or
Code:
SetTimer AutoHide, 100

AutoHide:
WinGetActiveTitle Title
If (Title <> TargetWindow)
    WinHide MyGui
Else
    WinShow MyGui
Return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 25th, 2012, 3:46 pm 
Offline
User avatar

Joined: May 28th, 2011, 9:03 am
Posts: 466
Location: Germany
... or you may try
Quote:
[v1.1.03+]: +Owner can be immediately followed by the name or number of an existing Gui or the HWND of any top-level window.
instead of AlwaysOnTop.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 25th, 2012, 4:05 pm 
Offline

Joined: July 10th, 2008, 8:49 am
Posts: 1865
Location: Brussels, Belgium
Code:
SetTimer FollowMe, 25

WinGet ID, ID, ahk_class Notepad++
WinGetPos X, Y, W, H, ahk_class Notepad++
Gui Add, Edit, w50
Gui +Owner%ID%
Gui Show, % "x" X + W " y" Y, GUIWindow
Return
FollowMe:
   WinGetPos X, Y, W, H, ahk_class Notepad++
   WinMove GUIWindow, , % X + W, % Y
Return

GuiClose:
GuiEscape:
ExitApp


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 26th, 2012, 12:42 am 
Offline

Joined: August 15th, 2009, 7:20 am
Posts: 308
Thanks for the replies. CodeKiller, from my understanding of IfWinActive and WinGetActiveTitle the buttons would be hidden once the application was not active, regardless of whether it was visible or not. It could be visible but not be active - in such a case I wouldn't want the buttons disappearing. Hence my question about stacking order.

Since posting I managed to find this old thread that mentioned a DLL call that sorts things out for me nicely.

GP


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 26th, 2012, 5:14 pm 
search for "Setparent" might be the best solution


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, hyper_, immunity, migz99, sjc1000 and 71 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group