home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / next / programm / 5730 < prev    next >
Encoding:
Text File  |  1992-08-21  |  1.5 KB  |  47 lines

  1. Newsgroups: comp.sys.next.programmer
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!rpi!ghost.dsi.unimi.it!itnsg1.cineca.it!lele
  3. From: lele@itnsg1.cineca.it (Lele Gaifax)
  4. Subject: How to change the cursor position in a TextField?
  5. Message-ID: <1992Aug21.123527.17413@itnsg1.cineca.it>
  6. Organization: Laboratorio di Fisica Computazionale, INFM. Trento Italia
  7. Date: Fri, 21 Aug 1992 12:35:27 GMT
  8. Lines: 37
  9.  
  10. Hi again,
  11. I'm still trying to get a better response from a TextField (from my pov, of
  12. course !-).
  13. I'd like to be able to programmatically change the contents of a TextField:
  14. whenever the user press the BackSpace key, I want the character preceeding the
  15. caret to be blanked, WITHOUT any other change in the text. In other words,
  16. if the user keeps pressing the BackSpace key, all the previous characters
  17. should be blanked, ie changed to blank chars, instead of removed at all.
  18.  
  19. My approach is simple; in my TextFilterFunction I do this:
  20.  
  21. static char *
  22. myTextFilter (id textObj,
  23.           char * inputText,
  24.           int * inputLength,
  25.           int position)
  26. {
  27.   ...
  28.   if (*inputText == NX_BACKSPACE)
  29.   {
  30.     [textObj setSel:position-1 :position];
  31.     return " ";
  32.   }
  33.   ...
  34. }
  35.  
  36. and it does work, but the caret obviously doesn't move and it keeps blanking
  37. the same position.
  38. Is it possible to move the caret from the application? How? (I tryied using
  39. moveCaret: but it does not work at all!)
  40.  
  41. Thanx a lot, 
  42. lele
  43. -- 
  44. Lele Gaifax - lele@itnsg1.cineca.it
  45. Sicuramente i cattivi hanno scoperto qualche cosa che i buoni ignorano.
  46.                         - Woody Allen
  47.