; 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
|