Snippets

From GNUstepWiki
Revision as of 11:17, 26 June 2005 by Andras (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Testing chars entered by users in NSTextField

(just for the case if someone else has the same problem)

1. Subclass NSTextField

2. In your subclass adopt the

        - (BOOL) textView: (NSTextView*) textView
        shouldChangeTextInRange: (NSRange) range
        replacementString: (NSString*) replacementString

method.

3. In this method you can access to the replacementString as char with the following line:

        char c = *([replacementString cString) + 0];  

4. Then you are free to examinate the conditions...

--Andras 13:17, 26 Jun 2005 (CEST)