Sprite Candy

Blitz3D Forums/Blitz3D Beginners Area/Sprite Candy

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.

My game uses a 3d terrain and selectable objects, I coded my GUI so that when I press ESC it brings up the options window. If I press ESC again it closes the options window. This is accomplished using the following code...

Function EscPress()
		If EscKey = 0
			EscKey = 1
			KeyShow = 1
			;Show Option window
			Win(1) = GUI_CreateWindow("Options",0,0,300,300,1+2+8,"CENTER","CENTER",-1)
			OptButtn1%     = GUI_AddButton   (Win(1), 10,40,120, "Help")
			GUI_WindowToFront Win(1)
		Else
			EscKey = 0
			KeyShow = 0
			;Hide Option Window
			GUI_RemoveWindow Win(1)	
		EndIf	
End Function




The problem is that I cant seem to click the close button or a help button on that option window when its open. I run a CheckWindow function every loop before the HUD_Update and GUI_Update functions to see if the user clicked the close window X button. It works sometimes, but mostly not at all. Im wondering if things that are happening in the back ground are causing the window to lose focus? I tried to keep that from happening by Checking if the Options window was open in the CheckWindow Function, if the window was open I use

If EscKey = 1 Then GUI_WindowToFront Win(1)

which I thought brought the window to the front of everything and basically gave it the focus.
I have been trying things for a few hours now and I cannot seem to get this going.

Any help would be greatly appreciated!