How to show the cursor in a text

Ned Konz ned at squeakland.org
Wed Feb 9 19:48:29 UTC 2005


On Wednesday 09 February 2005 11:04 am, stéphane ducasse wrote:

> I have been looking for the way to show the cursor on a text but up
> until now I failed dramatically.
> Does anybody has an idea?
>

Do you mean that you want the cursor to show up even when the TextMorph 
doesn't have the keyboard focus? That would be confusing if there were 
several such morphs visible: which one would you be typing into?

As it is now, the cursor is removed when the TM loses input focus. And it's 
only displayed when the TM is clicked.

Anyway, this will create a textmorph, select at its end, change the keyboard 
focus, and display the cursor:

t := TextMorph new contents: 100 at 100; contents: 'test'; openInWorld.
t editor selectFrom: 5 to: 4.
t editor selectAndScroll. 
ActiveHand newKeyboardFocus: t.
t changed.

-- 
Ned Konz
http://bike-nomad.com/squeak/



More information about the Squeak-dev mailing list