Unhandled Exception TextAreaText()?

BlitzMax Forums/BlitzMax Beginners Area/Unhandled Exception TextAreaText()?

Hiya.

I've been trying to make a simple XML-RPC client for use with a certain system I am a user at, but I keep encountering a "Unhandled Memory Exception Error" when I try to compile.

This seems to happen whenever I attempt to use TextAreaText() on any of the TextField gadgets.

I attempted to put default values in the fields, but that did not solve the problem. Does anyone here have an idea what am I doing wrong?

Code follows:

SuperStrict

Global XMLData$

Function SendData()
	
	Local Host$="127.0.0.1"
	Local Path$="/cgi-bin/xmlrpc.cgi"
	Local stream:TStream=OpenStream("tcp::"+Host$,False, True)
	
	If stream = Null Then
		SetStatusText(MyWindow,"Cannot connect to Host!")
	Else
		WriteLine stream,"POST "+Path$+" HTTP/1.1" 
		WriteLine stream,"Host: "+Host$ 
		WriteLine stream,"Content-type: application/x-www-form-urlencoded" 
		WriteLine stream,"Content-length: "+XMLData.length 
		WriteLine stream,"Connection: close"
		WriteLine stream, XMLData$
		stream.Close()
		SetStatusText(MyWindow, "Sent.")
	EndIf

End Function

Global MyWindow:TGadget=CreateWindow("XML/RPC Client", 40,40,300,200)
Local XMLKeyLabel:TGadget=CreateLabel("Channel:", 30, 10, 50, 20, MyWindow)
Local XMLKey:TGadget=CreateTextField(80, 10, 180, 20, MyWindow)
Local XMLIntLabel:TGadget=CreateLabel("Integer:", 30, 35, 50, 20, MyWindow)
Local XMLInt:TGadget=CreateTextField(80, 35, 180, 20, MyWindow)
Local XMLStrLabel:TGadget=CreateLabel("String:", 30, 60, 50, 20, MyWindow)
Local XMLStr:TGadget=CreateTextField(80, 60, 180, 20, MyWindow)

SetGadgetText(XMLKey, "a")	'Attempt to remove "null" from the gadgets
SetGadgetText(XMLInt, "b")  'to fix the crash - doesnt work though.
SetGadgetText(XMLStr, "c")

Local Button1:TGadget=CreateButton("Send", 110, 90, 50, 20, MyWindow, BUTTON_OK);

Print TextAreaText(XMLStr)	'Testing the crash issue here

Repeat
	WaitEvent()
	Print TextAreaText(XMLKey)
	Select EventID()
	Case EVENT_WINDOWCLOSE
		End
	Case EVENT_GADGETACTION
		Select EventSource()
		Case Button1
			Local key$=TextAreaText(XMLKey)
			Local i$=TextAreaText(XMLInt)
			Local str$=TextAreaText(XMLStr)
			XMLData="<?xml version="+Chr(34)+"1.0"+Chr(34)+"?><methodCall><methodName>llRemoteData</methodName><params><param><value><struct><member><name>Channel</name><value><String>"+key$+"</String></value></member><member><name>IntValue</name><value><Int>"+i$+"</Int></value></member><member><name>StringValue</name><value><String>"+str$+"</String></value></member></struct></value></param></params></methodCall>"
			SetStatusText(MyWindow, "Channel: "+TextFieldText(XMLKey)+" | Integer: "+TextFieldText(XMLInt)+" | String: "+TextFieldText(XMLStr))
			SendData()
		End Select
	End Select
Forever
End


You need to use TextFieldText.

TextAreaText is for TextArea gadgets.

Ahh thank you, that fixed it. :)