[Laszlo-user] text editing and insertion point position
Daniel Pool
dpool at inspiration.com
Fri Mar 10 13:21:28 EST 2006
For the application we are working on we have rich text fields that can
either be editable, or clickable/draggable.
When a text field is non-editable the mouse can be used to drag the
field by clicking and dragging the field.
When a text field is editable the field cannot be dragged but can have
the insertion point and selection is set by clicking and dragging in the
field.
The way to make an editable field non-editable is to click anywhere
outside of the field.
Clicking on an unselected field selects it.
The way to make a field editable is to click on the field when it is
already selected.
The problem is that when a selected, but non-editable field is clicked
on the insertion point should be set based on the position of the click.
I can see two possible solutions but I don't know how to implement
either of them. For selected but non-editable fields:
1...When the field gets a click set the editable property to true and
then post the click event to the field again, or create an event to post
to the field.
2...When the field gets the click from the x,y position of the click
determine the offset into the text-string of the field and call
setSelection based on the offset into the text-string.
I see a way to possibly implement the 2nd solution, but it is a really
ugly hack.
Does anyone have a suggestion as to how this should be done?
Thanks,
Daniel Pool.
More information about the Laszlo-user
mailing list