polymorph question

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

polymorph question

i have a subclass of PluggableTextFieldMorph. somewhere in the code i
set its contents with:
self textMorph contents: aString .
this sets the textcursor to the first position and makes him unvisible.
what i want to do is set the cursor to the last position and make him
visible (and movable). i tried it with:
self  textMorph editor selectAt: textMorph asText size +1 .
which does indeed what i want, but the textcurser is now unmovable by
the cursor keys. how do i make the cursor movable again?
i tried it eg with:
self  textMorph editor unselect .
but of course this did not work, instead it produced an error because
unselect calls markBlock: which does not exist. when i changed
TextEditor>>unselect to:
self editingState markBlock: self pointBlock copy
the error vanished, but it did not help .

Hence my question, how do i make the textcursor movable by the cursor keys?
( or move the cursor in a less intrusive way than with selectAt: )

as an aside, i noticed that focusChanged in PluggableTextFieldMorph is
not called at every focus change. in my subclass i first tried changing
keyboardFocusChange: in the obvious way, but interestingly this does not
help in _every_ case, i needed to change navigateFocusBackward and
navigateFocusForward. of course this has nothing to do with my question.