Z-order for Ahk Gui controls? Topic is solved
- PuzzledGreatly
- Posts: 1303
- Joined: 29 Sep 2013, 22:18
Z-order for Ahk Gui controls?
Is there a way to change the order for picture controls in an Ahk Gui? I need to change the zorder depending upon how two picture controls overlap. I know I can have duplicate controls and show or hide them but would prefer to avoid this. Thanks.
Re: Zorder for Ahk Gui controls?
I'm not sure if this is what you need, but I believe that the order is dictated by the order in which the commands appear in building the GUI.
- PuzzledGreatly
- Posts: 1303
- Joined: 29 Sep 2013, 22:18
Re: Zorder for Ahk Gui controls?
Thanks mikeyww, yes. What I'm looking for is a way to change this after the GUI is created. It would be good if GuiControl move/movedraw had an option for this.
Re: Zorder for Ahk Gui controls?
OK. Can't you determine the overlap factor before issuing Gui, Add?
- PuzzledGreatly
- Posts: 1303
- Joined: 29 Sep 2013, 22:18
Re: Z-order for Ahk Gui controls? Topic is solved
Use WinSet, Top/BottomPuzzledGreatly wrote:Is there a way to change the order for picture controls in an Ahk Gui?
Code: Select all
#NoEnv
#Warn
#SingleInstance, Force
Gui, New, HwndhGui -MinimizeBox, Control Z-Order
Gui, Margin, 20, 20
hbm1 := DllCall("CreateBitmap", "Int",1, "Int",1, "Int",0x1, "Int",32, "IntP",0xFF0000, "Ptr")
hbm2 := DllCall("CreateBitmap", "Int",1, "Int",1, "Int",0x1, "Int",32, "IntP",0x00FF00, "Ptr")
hbm3 := DllCall("CreateBitmap", "Int",1, "Int",1, "Int",0x1, "Int",32, "IntP",0x0000FF, "Ptr")
Gui, Add, Picture, xm ym w100 h100 hwndhPic1, HBITMAP:%hbm1%
Gui, Add, Picture, xp+24 yp+24 wp hp hwndhPic2, HBITMAP:%hbm2%
Gui, Add, Picture, xp+24 yp+24 wp hp hwndhPic3, HBITMAP:%hbm3%
ID := {"Red": hPic1, "Green": hPic2, "Blue": hPic3}
Gui, Add, Button, xm w50 gSetZorder, Red
Gui, Add, Button, x+6 wp gSetZorder, Green
Gui, Add, Button, x+6 wp gSetZorder, Blue
Gui, Show
Return
SetZorder:
WinSet, Bottom,, % "ahk_id" . ID[A_GuiControl]
WinSet, Redraw,, ahk_id %hGui%
Return
Re: Z-order for Ahk Gui controls?
Nice! Thank you, @SKAN.
Re: Z-order for Ahk Gui controls?
@mikeyww
- PuzzledGreatly
- Posts: 1303
- Joined: 29 Sep 2013, 22:18
Re: Z-order for Ahk Gui controls?
I've been so busy I missed looking at this thread. Thanks very much, SKAN.
Who is online
Users browsing this forum: anogoya, Descolada, Mannaia666, skeerrt and 139 guests