Bring a Gadget to the Top (Z Order)

BlitzMax Forums/MaxGUI Module/Bring a Gadget to the Top (Z Order)

CASO(Posted 2007) [#1]
Is there a way to tell a panel to come to the top of all the other panels?

I have a deck of cards on draggable panels but they stay in REVERSE order. The panel created last is on BOTTOM.

I tried to recreate the panel for the one I wanted on top when I found out that the new one goes to the BOTTOM.

Please help.


EOF(Posted 2007) [#2]
Not tested and Win32 only:

Extern "Win32"
	Function SetWindowPos(hwnd%,hWndInsertAfter%,x%,y%,w%,h%,wFlags%)
End Extern

Function ChangeGadgetOrder(src:TGadget,dst:TGadget,infront%=True)
	Const SWP_NOSIZE% = 1
	Const SWP_NOMOVE% = 2
	Local srcHwnd%=QueryGadget(src,QUERY_HWND)
	Local dstHwnd%=QueryGadget(dst,QUERY_HWND)
	If infront
		SetWindowPos dstHwnd,srcHwnd,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE
	Else
		SetWindowPos srcHwnd,dstHwnd,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE
	EndIf
End Function



If you know the top-most panel then use the above like this to move the new panel above the top one:

ChangeGadgetOrder newpanel,toppanel