Change Print/Input to TextArea?

BlitzMax Forums/BlitzMax Programming/Change Print/Input to TextArea?

Chapman7(Posted 2012) [#1]
The docs say:
The Print and Input commands can be redirected by setting the StandardIOStream Global to an alternative Stream Object.


I for the life of me cannot figure this out though. I feel like its going to be something easy that I overlooked but I am out of ideas here.

I am trying to make it print text to a textarea instead of the Output tab and input the same way.

Any advice would be apreciated!

Last edited 2012


Chapman7(Posted 2012) [#2]
Template of what I have so far:

SuperStrict

Import MaxGUI.Drivers

Local Window:TGadget = CreateWindow("Window", 0, 0, 600, 800, Null, WINDOW_TITLEBAR|WINDOW_CENTER)
Local TextArea:TGadget = CreateTextArea(0, 0, 600, 800, Window)

Local TestStream:TStream = OpenStream(TextArea, True, True)
Global StandardIOStream:TStream = TestStream
Print "Test"

Repeat
	WaitEvent()
	Select EventID()
		Case EVENT_WINDOWCLOSE
			End
	EndSelect

Forever



jsp(Posted 2012) [#3]
Do you just want to load some stuff into the TextArea?

Have a look here:
http://www.blitzmax.com/Community/posts.php?topic=95939#1109182


Chapman7(Posted 2012) [#4]
I want the print and input functions to go to a TextArea Gadget. So everytime I type Print "something" instead of it going to Output and then not really doing anything after I actually build the program, I want it to print out to a TextArea. I want input to work also this way.

Last edited 2012


matibee(Posted 2012) [#5]
This is from my list of "potentially useful bookmarks". Might help...

http://www.blitzmax.com/Community/posts.php?topic=87487


Chapman7(Posted 2012) [#6]
Yeah, I have messed with codes from that. The print works but I was never able to get input to work. I have also been looking at the MaxIDE source since that basically does what I need mine to do (as far as printing and getting input from a textarea) but I cant actually find the point of it writing to it.


jsp(Posted 2012) [#7]
Every input to the TextArea can be filtered. Grabbing the chars typed from that filter can may work.
Look at:
SetGadgetFilter( gadget:TGadget,callback(event:TEvent,context:Object),context:Object=Null )

While I could see print and input may work, I have no idea how you would do a change to a stream.
Also I somehow felt a console is may what you need, but could be wrong:
http://www.blitzmax.com/Community/posts.php?topic=86285#977909