TextBox

BlitzPlus Forums/BlitzPlus Beginners Area/TextBox

o-q(Posted 2006) [#1]
Think you guys are gonna get sick of me!
How do I create a TextBox and save the Inputed data as a string?
Like in a windows form!


GfK(Posted 2006) [#2]
I *think* Blitzplus and Blitzmax/MaxGUI are more or less the same, so something like this (make sure debug is enabled so you can see the output):
win = CreateWindow("test",50,50,200,120)
txt = CreateTextField(5,5,80,24,win)
SetGadgetText txt,"Hello"
btn = CreateButton("Click me",90,5,80,24,win)

Repeat
	WaitEvent()
	Select EventID()
		Case EVENT_WINDOWCLOSE
			End
		Case EVENT_GADGETACTION
			Select EventSource()
				Case btn
					DebugLog TextFieldText(txt)
			End Select
	End Select
Forever



o-q(Posted 2006) [#3]
Thanx for the fast reply, This we give me something to chew over for a few hours!


o-q(Posted 2006) [#4]
NO, I can't figure it out! :/
I think I must have asked the question wrong.
======================================
An Empty text box that can except user input and then the input saved as a string!

Is that a more procise question.


Adam Novagen(Posted 2006) [#5]
Actually, although I've never used B+, Gfk's code should work; just replace:
DebugLog TextFieldText(txt)
With something like:
MyString$ = TextFieldText(txt)



o-q(Posted 2006) [#6]
Thankyou ADAM
Now that makes sence to my small addled brain!


Adam Novagen(Posted 2006) [#7]
Hey, don't sweat it; I think all techie's brains are a little addled, which is why we're so great!