WinBlitz3d Events Help

Blitz3D Forums/Blitz3D Programming/WinBlitz3d Events Help

Hi Smiff

download www.winblitz3d.co.uk/WinBlitz3D_V1.1_Experimental.zip

ive added WB3D_QueueSize() this will return the total number of events in the queue.

using the example below i see '1' event on the queue, only when moving the trackbar with the mouse does this increase.

please try and report back your findings, we will try and get to the bottom of this problem.

Include "WB3DStyles.bb"

; setup gfx mode.
Graphics3D 640,480,16,2
Global switch=0

; install winblitz3d.
Global RuntimeWindow_hWnd = WB3D_InitializeGUI(SystemProperty("AppHwnd"),10,10,300,200)
WB3D_SetQuitMessage "WinBlitz3D 3D/GUI","Sure To Quit" 
;WB3D_HideGadget RuntimeWindow_hWnd

; create winapi window, setting its title, and position on screen. use default style creation.
example_window = WB3D_CreateWindow("WB3D_CreateWindow Example",200,100,450,275,0,0)
trackbar = WB3D_CreateTrackBar%(10, 24, 200, 30,example_window,0,TBS_AUTOTICKS Or TBS_TOP Or WS_CHILD Or WS_VISABLE)
WB3D_SetTrackBarRange (trackbar,0,100)
WB3D_SetTrackBarPos (trackbar,0)
button=WB3D_CreateButton%("Start",10, 60, 60, 20,example_window,0)

thislabel = WB3D_CreateEditField("",10,100,30,20,example_window,0,0)
spinner = WB3D_CreateSpinner(40, 100,50,20,example_window,0,0)
WB3D_SetSpinnerRange (spinner,0,100)
WB3D_SetSpinnerPos (spinner,0)
; cleanup any old creation events, its better to do this before we enter the main
; event loop, when some gadgets are created they generate events.
WB3D_FlushEvents 

; setup out quit flag, and loop until the flag is set.
QUIT = 0
While Not QUIT = 1
	
	; generate an internal blitz event
	Flip
	Cls
	Text 10,10,selected
	Text 10,40,WB3D_QueueSize()
	
	; get an event of the event queue.
	event = WB3D_WaitEvent()
	Select event
		
		
		Case WB3D_EVENT_GADGET
			selected = WB3D_EventSource()
			WB3D_GenerateEvents False
			Select selected
				Case button
					switch=Not switch
					If switch 
						WB3D_SetGadgetText(button,"Stop")
					Else
						WB3D_SetGadgetText(button,"Start")
					End If

				Case trackbar
					 WB3D_SetSpinnerPos(spinner,WB3D_GetTrackBarPos(trackbar))
				Case spinner
					 WB3D_SetTrackBarPos(trackbar,WB3D_GetSpinnerPos(spinner))
				
				
				
			
			End Select
			WB3D_GenerateEvents True

		Case WB3D_EVENT_KEYPRESS
		
			; wb_eventdata holds the key code that was pressed.
			keypressed = WB3D_EventData()
			Select keypressed
				
				Case WB3D_KEY_ESCAPE	
					
					; set the flag to leave the loop.
					QUIT = 1
					
			End Select
				
		Case WB3D_EVENT_WINDOW_CLOSE
		
			; wb3d_eventsource hold the handle to the window that close button was selected
			window = WB3D_EventSource()
			Select window
			
				Case example_window
					
					; set the flag to leave the loop.
					QUIT = 1
					
			End Select
	End Select
	
	If switch
		count=count+1
			If count>100 count=0
				WB3D_GenerateEvents False
				WB3D_SetTrackBarPos (trackbar,count)
				WB3D_SetSpinnerPos (spinner,count)
				WB3D_GenerateEvents True
			End If	

	

Wend

; use notify using external winapi constants. 
WB3D_Notify "WB3D GUI Window Example","Bye, Thats It I Quit",MB_OK Or MB_ICONASTERISK
WB3D_EndGUI()
EndGraphics
End


kev