textFieldtext

BlitzPlus Forums/BlitzPlus Programming/textFieldtext

Is there a way to limit the amout of characters inputed into a text field? Or does this have to be programmed manually?

; 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


thx syntax ;) all apologies for changing the topic (i figured out the other one and this was question number two :) )

I wondered where it went ;-)

;)
How much do I owe you for all this time your putting in ;)

j.k.

Nothing while I'm still in a good mood 8-D