text cursor's location and look

Robert Brenstein rjb at rz.uni-potsdam.de
Wed Jan 7 16:21:02 EST 2004


>?Is there a built-in MC command, function, message, or etc. which I can use
>within a script to:
>
>1. know or control the text cursor's location within a text field, e.g.,
>"put the textCursorLoc (?) between the 18th and 19th characters of line 3 of
>field "fText";
>
>2. change the shape of the text-cursor, for example, from a flashing I-beam
>to an underscore.
>
>I'm creating a text-input interface which relies solely on mouse-clicks and
>button objects. No computer keyboard or mouse cursor can be used, since I'm
>trying to recreate how a (Japanese) cell-phone relies on only its
>alphanumeric number-pad to enter text.
>
>Thank you.
>
>--
>Nicolas Cueto

I am catching up with posts accumulated over Xmas and see only one 
and not quite complete answer, although you might have had this 
resolved in the meantime.

1. You would use the select command. However, if your point is to 
simply insert text (chars) entered through a button, then instead of 
select you just use put. As in "put char "xyz" after char 18 of line 
3 of fld "fText" The selectedChunk can be used to find the current 
cursor position but in your task, you should track in in variable 
rather then fetching from field.

2. You can't change the I-beam cursor if that what you mean by 
text-cursor. However, you may not want to do that anyway -- this 
cursor implies that user can use a keyboard input whereas you want 
them to use buttons. I would insert a small image (like colored 
underscore) to indicate the entry position or simpler, insert some 
non-alpha character from the current font to perform the same 
function but make it bold and/or in color. You will need to 
explicitely handle it only when user uses left/right movement (like 
arrows) keys. For normal text insertion, you would "put blah blah 
before char nn" where nn refers to cursor position. It may be even 
simpler to keep track of its absolute position within field (as 
opposed to char within a specific line).

Your task is surely doable without major hassles.

Robert


More information about the metacard mailing list