window to the top

BlitzMax Forums/BlitzMax GUI Programming/window to the top

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Yep, use ActivateWindow when open or ShowGadget when hidden to get the window on top

SuperStrict

'End Of external Header File

Global	Window2:TGadget
Global	Window3:TGadget

Window2:TGadget = CreateWindow:TGadget("Window2",475,99,169,71,Null,WINDOW_TITLEBAR|WINDOW_RESIZABLE |WINDOW_STATUS |WINDOW_CLIENTCOORDS )
Local Window1:TGadget = CreateWindow:TGadget("Window1",267,127,329,182,Null,WINDOW_TITLEBAR|WINDOW_RESIZABLE |WINDOW_STATUS |WINDOW_CLIENTCOORDS )
	Local Button1:TGadget = CreateButton:TGadget("Window2",43,40,75,23,Window1:TGadget,BUTTON_PUSH)
	Local Button1_c2:TGadget = CreateButton:TGadget("Window3",43,98,75,23,Window1:TGadget,BUTTON_PUSH)
Window3:TGadget = CreateWindow:TGadget("Window3",468,255,180,79,Null,WINDOW_TITLEBAR|WINDOW_RESIZABLE |WINDOW_STATUS |WINDOW_CLIENTCOORDS )

Repeat
	WaitEvent()
	Select EventID()
		Case EVENT_WINDOWCLOSE
			Select EventSource()
				Case Window2	Window2_WC( Window2:TGadget )
				Case Window1	Window1_WC( Window1:TGadget )
				Case Window3	Window3_WC( Window3:TGadget )
			End Select

		Case EVENT_GADGETACTION
			Select EventSource()
				Case Button1	Button1_GA( Button1:TGadget )
				Case Button1_c2	Button1_c2_GA( Button1_c2:TGadget )
			End Select

	End Select
Forever

Function Window2_WC( Window:TGadget )
	DebugLog "Window Window2 wants to be closed"
'	HideGadget( Window:TGadget )

	End
End Function

Function Window1_WC( Window:TGadget )
	DebugLog "Window Window1 wants to be closed"
'	HideGadget( Window:TGadget )

	End
End Function

Function Window3_WC( Window:TGadget )
	DebugLog "Window Window3 wants to be closed"
'	HideGadget( Window:TGadget )

	End
End Function

Function Button1_GA( Button:TGadget )
	DebugLog "Button Button1 was pressed"
	ActivateWindow(Window2)
End Function

Function Button1_c2_GA( Button:TGadget )
	DebugLog "Button Button1_c2 was pressed"
	HideGadget(Window3)
ShowGadget(window3)
End Function