🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.programmer
Article #1257

How to change the cursor position in a TextField?

#1257
From: Lele Gaifax
Date: Fri, 21 Aug 1992 12:35
37 lines
1578 bytes
Hi again,
I'm still trying to get a better response from a TextField (from my pov, of
course !-).
I'd like to be able to programmatically change the contents of a TextField:
whenever the user press the BackSpace key, I want the character preceeding the
caret to be blanked, WITHOUT any other change in the text. In other words,
if the user keeps pressing the BackSpace key, all the previous characters
should be blanked, ie changed to blank chars, instead of removed at all.

My approach is simple; in my TextFilterFunction I do this:

static char *
myTextFilter (id textObj,
	      char * inputText,
	      int * inputLength,
	      int position)
{
  ...
  if (*inputText == NX_BACKSPACE)
  {
    [textObj setSel:position-1 :position];
    return " ";
  }
  ...
}

and it does work, but the caret obviously doesn't move and it keeps blanking
the same position.
Is it possible to move the caret from the application? How? (I tryied using
moveCaret: but it does not work at all!)

Thanx a lot, 
lele
-- 
Lele Gaifax - lele@itnsg1.cineca.it
Sicuramente i cattivi hanno scoperto qualche cosa che i buoni ignorano.
						- Woody Allen
Technical Details
Message-ID: <1992Aug21.123527.17413@itnsg1.cineca.it>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!rpi!ghost.dsi.unimi.it!itnsg1.cineca.it!lele

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!rpi!ghost.dsi.unimi.it!itnsg1.cineca.it!lele
From: lele@itnsg1.cineca.it (Lele Gaifax)
Subject: How to change the cursor position in a TextField?
Message-ID: <1992Aug21.123527.17413@itnsg1.cineca.it>
Organization: Laboratorio di Fisica Computazionale, INFM. Trento Italia
Date: Fri, 21 Aug 1992 12:35:27 GMT
Lines: 37