GUI, LABOX problem :S

Blitz3D Forums/Blitz3D Beginners Area/GUI, LABOX problem :S

Apollonius(Posted 2003) [#1]
Labox shouldnt have the problem,
search for this in my code:
<- Heres the error ?

Run the code look the top bar is over the others and its drawn before them.... whats wrong?

AppTitle "CL WARS"

	; Create Main Window
	w% = 300;GadgetWidth(Desktop()) - 100
	h% = 300;GadgetHeight(Desktop()) - 100
	x% = (ClientWidth(Desktop()) - w) / 2
	y% = (ClientHeight(Desktop()) - h) / 2
	wndMain = CreateWindow("                         Coalition Legions WARS", x, y, w, h,0,17)
	
	MainPanel = CreatePanel(0,0,295,200,wndMain,1)
	
	lb_main = CreateLabox(" Player ",20,2,250,100,50,1,MainPanel)
	;CreateButton("Options",0,0,100,20,MainPanel)
	
quit=False
Repeat
	WaitEvent()
	If EventID()=$803
            If EventSource()=wndMain
		quit=True
            End If
	EndIf
Until quit


Function CreateLabox(b_text$,b_x,b_y,b_width,b_height,lab_width,lab_style,b_parent)
	Local pan = CreatePanel(b_x, b_y, b_width,b_height, b_parent)
	temp = CreatePanel( 0,5, b_width, 4, pan, 1)                         ; Top    <- Heres the error ?
	SetGadgetLayout temp,1,1,1,0
	temp = CreatePanel( 0, 5+2, 4, b_height-3, pan, 1)                   ; Left
	SetGadgetLayout temp,1,0,1,1
	temp = CreatePanel( 0, b_height-2, b_width,4, pan, 1)                ; Bottom
	SetGadgetLayout temp,1,1,0,1
	temp = CreatePanel( b_width-3, 5, 4, b_height, pan, 1)               ; Right
	SetGadgetLayout temp,0,1,1,1
	temp = CreateLabel( b_text$, 10, 0, lab_width, 16, pan, lab_style)   ; Text
	SetGadgetLayout temp,1,0,1,0
	Return pan
End Function



Apollonius(Posted 2003) [#2]
Is this to complex for you guys?


WolRon(Posted 2003) [#3]
I've only recently acquired BlitzPlus and haven't messed with the GUI part of it yet, so I'm not familiar with it.

My 'guess' might be that the GUI elements are not necessarily drawn in the same order that they are created. In fact, I wouldn't be surprised at all if this is how it works.

On the contrary, perhaps the Top one is drawn last because it was created first?


EOF(Posted 2003) [#4]
Try this replacement. I removed the SetGadgetLayout commands to get this looking right:
Function CreateLabox(b_text$,b_x,b_y,b_width,b_height,lab_width,lab_style,b_parent)
	Local pan = CreatePanel(b_x, b_y, b_width,b_height, b_parent)
	temp = CreatePanel( 0,5, b_width, 4, pan, 1)
	temp = CreatePanel( 0, 5+2, 4, b_height-3, pan, 1)
	temp = CreatePanel( b_width-4, 5+2, 4, b_height-3, pan, 1)
	temp = CreatePanel( 0, b_height-2, b_width,4, pan, 1)
	temp = CreateLabel( b_text$, 10, 0, lab_width, 16, pan, lab_style)   ; Text
	Return pan
End Function