Panel Hiding

BlitzMax Forums/BlitzMax GUI Programming/Panel Hiding

Hi,
I want to create a ProgBar that's clickable.
And by clickable I mean that you can click anywhere on the
ProgBar and you'll get the Mouse X and Y coordinates.

I'm going to use it as a Slider, because the slider is so damn ugly.

Strict

Local WW:Int = 200
Local WH:Int = 30
Local WX:Int = GadgetWidth(Desktop())/2-WW/2
Local WY:Int = GadgetHeight(Desktop())/2-WH/2
Global MainWindow:TGadget = CreateWindow( "Testing.", WX, WY, WW, WH, Null, WINDOW_TITLEBAR | WINDOW_CLIENTCOORDS )

Global MainWindowPanel:TGadget = CreatePanel( 5 , 5 , WW - 10 , 20 , MainWindow , PANEL_ACTIVE ) 
'HideGadget( MainWindowPanel )
Global MainWindowProgbar:TGadget = CreateProgBar( 5, 5, WW-10, 20, MainWindow )
'Global MainWindowPanel:TGadget = CreatePanel( 5 , 5 , WW - 10 , 20 , MainWindow , PANEL_ACTIVE ) 

Repeat
	If PeekEvent() <> Null
		WaitEvent()
		Select EventID()
			Case EVENT_WINDOWCLOSE
				End
			Case EVENT_MOUSEDOWN
				Print "MOUSEDOWN Event."
		End Select
	EndIf
	
	Delay 2
	
Forever


This is the code I've come up with, as long as I don't hide the panel it works, but then I can't see the Progbar :P
And if I draw the Panel under the Progbar, the mouseevents won't show up.

Any solutions to this?

Thanks :)

I created a small example on how I want it to work, but with 2 Panels instead of 1 Panel and 1 ProgBar.

SuperStrict

Global MWW:Int = 200
Global MWH:Int = 100
Global MWX:Int = ClientWidth(Desktop())/2-MWW/2
Global MWY:Int = ClientHeight(Desktop())/2-MWH/2
Global MainWindow:TGadget = CreateWindow( "Test" , MWX , MWY , MWW , MWH , Null , WINDOW_TITLEBAR | WINDOW_CLIENTCOORDS )

Global Panel2:TGadget = CreatePanel( 5 , 5 , 0 , 20 , MainWindow , PANEL_ACTIVE ) 
SetGadgetColor Panel2, 0, 255, 0

Global Panel1:TGadget = CreatePanel( 5 , 5 , MWW - 10 , 20 , MainWindow, PANEL_ACTIVE )
SetGadgetColor Panel1, 255, 0, 0

Global Down:Int = 0

Repeat
	If PeekEvent() <> Null
		WaitEvent()
		Select EventID()
			Case EVENT_WINDOWCLOSE
				End
			Case EVENT_MOUSEDOWN
				Down = 1
				
			Case EVENT_MOUSEUP
				Down = 0
				
		End Select
	EndIf
	
	If Down = 1
		If EventX() < GadgetWidth( Panel1 )
			SetGadgetShape( Panel2 , 5 , 5 , EventX() , 20 )
		Else
			SetGadgetShape( Panel2 , 5 , 5 , GadgetWidth( Panel1 ) , 20 )
		EndIf
	EndIf
Forever


Just for easier understanding ;)

Thanks :)