Weird Error

BlitzMax Forums/BlitzMax Beginners Area/Weird Error

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.

Import maxgui.drivers

Local win:tgadget=CreateWindow("My Window",40,40,320,240)


In("Hallo" , win , 0) 


Function In:String(Message:String, MainWindow:TGadget, IsChoice:Int = 0, Choices:TList = Null)
	Local Message_Window:TGadget = CreateWindow(Message, 100, 100, 320, 240)
	Local Message_Label:TGadget = CreateLabel(Message, 0, 0, 320, 20, Message_Window)
	Local Message_Button:TGadget = CreateButton("Ok", 130, 150, 60, 20, Message_Window)
	Local Message_ListBox:TGadget = CreateListBox(0, 20, 320, 130, Message_Window)
	HideGadget(Message_ListBox)
	Local Message_TextField:TGadget = CreateTextField(0, 20, 320, 20, Message_Window)
	HideGadget(Message_TextField)
	Local ExitTime:Int = False
	Local Temp_String:String
	
	If IsChoice = True
		ShowGadget(Message_ListBox)

		For Temp_String = EachIn Choices
			AddGadgetItem(Message_ListBox, Temp_String)
		Next
	ElseIf IsChoice = False
		Message_Window.height = 100
		Message_Button.ypos = 20
		ShowGadget(Message_TextField)
	End If
	
	While Not ExitTime = True
		WaitEvent()
		Select EventID()
			Case EVENT_WINDOWCLOSE
				Select EventSource()
					Case Message_Window
						ExitTime = True
					Case MainWindow
						End
				End Select
			Case EVENT_GADGETACTION
				Select EventSource()
					Case Message_Button
						ExitTime = True
				End Select
		End Select
	Wend
	'FreeGadget(Message_Window) <--- if you free the message_window you cant' return anything....all the gadgets will be freed!
	If IsChoice = True
		Print SelectedGadgetItem(Message_ListBox)
		Return GadgetItemText(Message_ListBox, SelectedGadgetItem(Message_ListBox))
	ElseIf IsChoice = False
		Return TextFieldText(Message_TextField)
	End If
End Function

Where is the error?