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.

I'm working on making a (possibly) open-source library of code for RPGs, mostly text RPGs...

Unfortunetly in order for portablity between console and GUI alike I've run into a problem with an "In" function which is essential input() for maxGUI.

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 IsChoice = True
		Print SelectedGadgetItem(Message_ListBox)
		Return GadgetItemText(Message_ListBox, SelectedGadgetItem(Message_ListBox))
	ElseIf IsChoice = False
		Return TextFieldText(Message_TextField)
	End If
End Function

That's the code, but whenever I compile it gives this error:
Unhandled Exception:Invalid Gadget type

Any help/suggestions?