Martin wrote: > There have been alot of how to questions on the list lately so here is > another one for the Edit Field Experts. > > How can I restrict the number of characters that a user can type into an > edit field. Using _framedNoCR gives us a field that can be typed into, > let's say we only want the user to type 50 characters or at most stop at > the width of the field. If you hadn't noticed you can keep typing beyond > the length of the visible field and when you grab the contents it has > the extra there. > > Using LEFT$ is no good as that is an after the event type process. > > I want to be able to tell them as they are typing enough is enough. > > In GFA BASIC for PC the edit field does the job. > > Any suggestions > > Fitzy I encountered this problem but solved it fairly easily. Use ON EDIT fn filterKeys to check the number of characters in the field each time a key is pressed: LOCAL FN filterKeys key$ = TEKEY$ LONG IF LEN(EDIT$(efID)) =< maxChars TEKEY$ = key$ 'Ok send the keystrokes through XELSE BEEP 'Too many chars in edit field! END IF END FN ON EDIT fn filterKeys