MaxGUI: strange waitevent() / Paste issue

BlitzMax Forums/BlitzMax Programming/MaxGUI: strange waitevent() / Paste issue

The following code creates an app that generates enum types, currently you have to copy the output using ctrl+c, when I do this and switch to the IDE to paste it in, the IDE halts until I switch back to the app (or just mouseover it).
SuperStrict
Framework BRL.Win32MaxGUI
Import BRL.Retro


Global quit:Int = False

Global dt : TGadget = Desktop()

Global iWidth : Int = GadgetWidth(dt) - (GadgetWidth(dt)*0.4) 'set width to 60%
Global iHeight : Int = GadgetHeight(dt) - (GadgetHeight(dt)*0.4) 'Set height to 60%
Global iXPos : Int = (GadgetWidth(dt)-iWidth)/2
Global iYPos : Int = (GadgetHeight(dt)-iHeight)/2

Global wMainWin : TGadget = CreateWindow("EnumGen", iXPos, iYPos, iWidth, iHeight, Null, WINDOW_TITLEBAR)

Global lblEnumName : TGadget = CreateLabel("Enum Name:",((iWidth-(iWidth*0.8))/2), 0, iWidth*0.2, 12, wMainWin)
Global tfEnumName:TGadget = CreateTextField((iWidth-(iWidth*0.8))/2, 14, iWidth*0.2, 22, wMainWin)

Global lblEnumType : TGadget = CreateLabel("Enum Type:",((iWidth-(iWidth*0.8))/2)+(iWidth*0.2), 0, iWidth*0.2, 12, wMainWin)
Global cbEnumType : TGadget = CreateComboBox(((iWidth-(iWidth*0.8))/2)+(iWidth*0.2), 14, iWidth * 0.2, 34, wMainWin)
	AddGadgetItem(cbEnumType, "Int")
	AddGadgetItem(cbEnumType, "Float")
	AddGadgetItem(cbEnumType, "Bitwise")
	SelectGadgetItem(cbEnumType, 0)

Global lblEnumStep : TGadget = CreateLabel("Step:",((iWidth-(iWidth*0.8))/2)+(iWidth*0.4), 0, iWidth*0.2, 12, wMainWin)
Global tfEnumStep:TGadget = CreateTextField(((iWidth-(iWidth*0.8))/2)+(iWidth*0.4), 14, iWidth*0.2, 22, wMainWin)
	SetGadgetText(tfEnumStep, "1")

Global lblStart : TGadget = CreateLabel("Start Value:",((iWidth-(iWidth*0.8))/2)+(iWidth*0.6), 0, iWidth*0.2, 12, wMainWin)
Global tfStart:TGadget = CreateTextField(((iWidth-(iWidth*0.8))/2)+(iWidth*0.6), 14, iWidth*0.2, 22, wMainWin)


Global lblEnumList:TGadget = CreateLabel("Enum Keyword List:",((iWidth-(iWidth*0.8))/2), 42, iWidth, 12, wMainWin)
Global taEnumList:TGadget = CreateTextArea((iWidth-(iWidth*0.8))/2, 56, iWidth*0.8, (iHeight-56)*0.4, wMainWin)


Global btnProcess:TGadget = CreateButton("&Process", ((iWidth-(iWidth*0.8))/2), ((iHeight-56)*0.4)+58, iWidth*0.1, 22, wMainWin)


Global lblOutput:TGadget = CreateLabel("Output:",((iWidth-(iWidth*0.8))/2), (90+((iHeight-90)*0.4))+4, iWidth, 12, wMainWin)
Global taOutput:TGadget = CreateTextArea((iWidth-(iWidth*0.8))/2, (90+((iHeight-90)*0.4))+18, iWidth*0.8, (iHeight-90)*0.4, wMainWin, TEXTAREA_READONLY)



While Not Quit

	WaitEvent()

	Select EventID()
		Case EVENT_WINDOWCLOSE
			Quit = True
		Case EVENT_GADGETACTION
			Select EventSource()
				Case btnProcess
					If Verify() Then 
						Process() 
					EndIf
			End Select
	End Select

Wend

End


Function Verify:Int()
	'Local function
	Function CheckString:Int(val:String)
		Local disallow:String[] = ["~q","~t","!","£","$","%","^","&","*","(",")","+","-","=","[","]"..
									,"{","}",":","@","~~",";","'","#",",",".","/","<",">","?"]
		
		For Local s:String = EachIn disallow
			If val.find(s)>-1 Then Return False
		Next
		
		Return True
	End Function


	If Len(TextFieldText(tfEnumName))<1 Then 
		Notify("Enum name required")
		Return False
	EndIf
	
	
	If Not CheckString(TextFieldText(tfEnumName)) Then 
		Notify("Invalid character in EnumName!")
		Return False
	EndIf
	
	
	Select SelectedGadgetItem(cbEnumType)
		Case 0
			If Not Int(TextFieldText(tfEnumStep)) Then 
				Notify("Step is not an int value")
				Return False
			EndIf

			If Not Int(TextFieldText(tfStart)) Then 
				Notify("Start is not an int value")
				Return False
			EndIf

		Case 1
			If Not Float(TextFieldText(tfEnumStep)) Then 
				Notify("Step is not an float value")
				Return False
			EndIf
			
			If Not Float(TextFieldText(tfStart)) Then 
				Notify("Start is not an float value")
				Return False
			EndIf

		Case 2
			If Not Int(TextFieldText(tfStart)) Then 
				Notify("Start is not an int value")
				Return False
			EndIf
	End Select

	
	If Not CheckString(Trim(TextAreaText(taEnumList))) Then 
		Notify("Invalid character in Enum List!")
		Return False
	EndIf

	If Len(Trim(TextAreaText(taEnumList))) < 1 Then 
		Notify("No enum variable items specified")
		Return False
	EndIf
	
	Return True
End Function



Function Process()
	Local outText:String
	Local outType:String
	
	Local IntCount:Int = Int(TextFieldText(tfStart))
	Local FloatCount:Float = Float(TextFieldText(tfStart))
	
	Local IntStep:Int = 1
	Local FloatStep:Float = 1.0

	
	
	Select SelectedGadgetItem(cbEnumType)
		Case 0
			outType = "Int"
			IntStep = Int(TextFieldText(tfEnumStep))
			
		Case 1
			outType = "Float"
			FloatStep = TextFieldText(tfEnumStep).ToFloat()
			
		Case 2
			outType = "Int"
			'intCount = 1
	End Select
	outText :+ "'ENUM " + Trim(TextFieldText(tfEnumName)) + "~n"
	outText :+ "Type T" + Trim(TextFieldText(tfEnumName)) + " Final~n"
	Local enumList:TList = SplitString(Trim(TextAreaText(taEnumList)), "~n")
	
	For Local s:String = EachIn enumList
		s = Trim(s) 'remove invisible chars
		outText:+ "~tConst " + s + " : " + outType + " = "
		
		Select SelectedGadgetItem(cbEnumType)
			Case 0 'Int
				outText:+ IntCount
				IntCount:+ IntStep
			Case 1 'Float
				outText:+ FloatCount
				FloatCount:+ FloatStep
			Case 2 'Bitwise
				outText:+ IntCount
				IntCount =  (IntCount*2)
		End Select
		
		outText:+"~n"
		
	Next
	outText:+"End Type~n"
	SetTextAreaText(taOutput, outText)
End Function



Function SplitString:TList(inString:String, Delim:String)
	Local tempList : TList = New TList
	Local currentChar : String = ""
	Local count : Int = 0
	Local TokenStart : Int = 0
	
	If Len(Delim)<>1 Then Return Null
	
	inString = Trim(inString)
	
	For count = 0 Until Len(inString)
		If inString[count..count+1] = delim Then
			tempList.AddLast(inString[TokenStart..Count])
			TokenStart = count + 1
		End If
	Next
	tempList.AddLast(inString[TokenStart..Count])	
	Return tempList
End Function


It appears to be caused by WaitEvent(), if you change it to PollEvent() it works fine.

could someone at least confirm it happens for them so that I know my system isn't crap?

Confirmed. Same issue here Perturbatio.
Tried it with Notepad. Same again.

I see the same thing, weird that it pastes when you mouseover EnumGen.

Another issue you might want to be aware of -- I use dual monitors, and on a dual monitor setup Desktop() apparently means the entire space of both monitors. This app starts centered between the two monitors (half on one monitor and half on the other monitor), and since it is not sizeable and takes up 60% of the dual monitor space, it isn't even possible to make it display on one screen.

Mark.

yeah, I was just experimenting with dynamic sizing when I did that :)

Is this related to the way that drag and dropped icons don't always seem to register until I move the mouse pointer? Or is that one just me?

I notice that too with my Framework Assistant.