This is driving me potty

BlitzMax Forums/MaxGUI Module/This is driving me potty

D4NM4N(Posted 2006) [#1]
Please, please can someone put my mind at rest and tell me why neither the cancelbutton or the escape key exits my
loop. >:O

here is the chunk of the loop in question. There is a large delay while the images load, but i dont understand why its not buffering the keyhit/button click
		SetGadgetText(pblabel,"Loading Colormap......")
		proc=proc+1;UpdateProgBar(pbar,Float(proc)/Float(processes))
		inmapcolor:TPixmap=LoadPixmap(colorfile$)

		SetGadgetText(pblabel,"Loading Alphamap......")
		proc=proc+1;UpdateProgBar(pbar,Float(proc)/Float(processes))
		inmapalpha:TPixmap=LoadPixmap(alphafile$)
		
		Select WaitEvent()
			Case EVENT_GADGETACTION						' interacted with gadget
			  	Local esrc:Object=EventSource()
			  	Select esrc
			  		Case cancelit
			  		   Exit
			  	End Select

		  	Case EVENT_KEYUP
		  		Select EventData()
					Case KEY_ESCAPE
						Exit
				End Select
			
			Case EVENT_WINDOWCLOSE						' close gadget
				Exit			
		End Select
	  	



Dreamora(Posted 2006) [#2]
I would take out input handling from the core loop due to the modal behavior of some gadgets.

Use a hook for the input handling and set a global "quit" variable to true to leave the loop.
Then this type of problem shouldn't be present anymore.
At least beside the load. The load puts the whole app on hold until finished. So no events are processed and potentially could overwrite old events at some point.