Only one button works..?

BlitzMax Forums/BlitzMax Beginners Area/Only one button works..?

bookworm99(Posted 2008) [#1]
Hi all,

Just got MaxGUI, and I'm following the tutorials at 2DGamers and trying my hand at GUI coding! I am having a strange problem, though - I have two buttons, both of which are supposed to change text when clicked, but only one of them - the second one declared, always - works. Here's my code:

 
SuperStrict 

Global style:Int = WINDOW_TITLEBAR|WINDOW_RESIZABLE|WINDOW_MENU|WINDOW_STATUS
Global clickedFirst:Int = 0 
Global myWindow:TGadget=createwindow("MyWindow",500,500,800,600,Null,style)
Global secondButton:TGadget=createbutton("No, click ME!",150,200,400,400,myWindow)
Global firstButton:TGadget=createbutton("Click ME!",150,150,400,400,myWindow)
Repeat
WaitEvent()
	setstatustext myWindow, "MyWindow Created Successfully... Size (width/height): " + clientwidth(myWindow)+ ", "+clientheight(myWindow)+ ". Style: "+style 
	Select EventID() 
		Case EVENT_WINDOWCLOSE
			End 
		Case EVENT_GADGETACTION
			Select EventSource()
				Case secondButton
					setgadgettext(secondButton,"You clicked ME!") 
				Case firstButton
					setgadgettext(firstButton,"You clicked on ME!") 
			End Select 
		End Select 
Forever 
End 


Any idea why? I get no warnings or errors when I compile.


jsp(Posted 2008) [#2]
You defined the buttons more or less one on top of the other. I made them just a bit smaller!




bookworm99(Posted 2008) [#3]
Oddly enough, that fixed it. Many thanks!


Dreamora(Posted 2008) [#4]
thats not odd. you only had one button that you could interact with as they are one above each other ...

gadgets may overlay but the moment one is totally covered, the gadget below, even if visible, will not be interactable anymore!