textFieldtext

BlitzPlus Forums/BlitzPlus Programming/textFieldtext

gellyware(Posted 2004) [#1]
Is there a way to limit the amout of characters inputed into a text field? Or does this have to be programmed manually?


EOF(Posted 2004) [#2]
; Textfield - changing / limiting characters entered
win=CreateWindow("TextField - Change/Limit Characters",270,240,234,104,Desktop(),1)
tf=CreateTextField(20,20,160,20,win,0)

Const maxchars=14

Repeat
	ev=WaitEvent()

	If EventSource()=win ActivateGadget win
	Select ev
		Case $803 ; close [X]
		Exit
		Case $401 ; gadgethit
		If EventSource()=tf ; textfield
			SetGadgetText tf,Left$(TextFieldText$(tf),maxchars)
			If EventData()=13
				If TextFieldText$(tf)="blitz"
					SetGadgetText tf,"rules"
				Else
					SetGadgetText tf,""
				EndIf
			EndIf
		EndIf
	End Select
Forever

End



gellyware(Posted 2004) [#3]
thx syntax ;) all apologies for changing the topic (i figured out the other one and this was question number two :) )


EOF(Posted 2004) [#4]
I wondered where it went ;-)


gellyware(Posted 2004) [#5]
;)
How much do I owe you for all this time your putting in ;)

j.k.


EOF(Posted 2004) [#6]
Nothing while I'm still in a good mood 8-D