GuiMLTextEditCtrl - can't use cursor keys to hilite text ?
by Orion Elenzil · in Torque Game Engine · 12/16/2008 (5:31 pm) · 3 replies
Apologies if this has been hashed out already,
but does anyone know the story behind this bit of code ?
but does anyone know the story behind this bit of code ?
void GuiMLTextEditCtrl::handleMoveKeys(const GuiEvent& event)
{
if ( event.modifier & SI_SHIFT )
return;
mSelectionActive = false;About the author
#2
the original implementation of text selection/editing seems a bit .. funny to me tho,
so it will have some refactoring and a few changes to existing behaviour.
12/17/2008 (11:59 am)
So i'm doing this.the original implementation of text selection/editing seems a bit .. funny to me tho,
so it will have some refactoring and a few changes to existing behaviour.
#3
i haven't yet merged it into a truly stock codebase, but it should be allright.
anyhow,
1.3.5 / 1.4 GuiMLTextEditCtrl shortcomings:
-------------------------------------------
* text could only be selected with mouse, not with arrow keys.
* poor cursor movement support (no ctrl-home, ctrl-end, to say nothing of shift-ctrl-home).
* no undo.
* non-blinking cursor.
* up- and down-arrow keys move cursor to beginning of line.
(this seems fixed in TGE 1.5.2)
So here are the improvements:
-----------------------------
* text can now be selected by holding shift and using the arrow keys.
also works with home, end, and shift-home and shift-end.
* added an undo and redo system, with 500-step history buffer.
(this is a more sophisticated undo/redo than in GuiTextEditCtrl)
* added ctrl-A = select all.
* added ctrl-insert = copy and shift-insert = paste.
* improved arrow-key navigation.
* improved cursor alignment with text characters.
* cursor now blinks.
* changed TAB and shift-TAB to do the regular focus-switching thing
instead of actually inserting spaces into the text.
* refactored away some code duplication,
as well as allowing more flexible key-modifiers like ctrl+shift.
* use proper modifier key on Mac.
(this may not compile in stock TGE, pls. let me know)
while i'm on the topic,
this control seems to have suffered some setbacks in TGE 1.5.
here's a quick console command you can use to try this out:
* the cursor is one character to the left of where it should be.
* .. which makes it sometimes appear at the end of the previous line.
* if you right-arrow in a line, then up-arrow, then down-arrow, the cursor has moved left.
* the insertion point can sometimes get wildly off from the cursor:
start a new line, enter a few characters, then pres ctrl-L a few times.
the cursor moves to the right, the text-insertion point does not.
when in this state, using the mouse to highlight text produces some truly strange behaviour.
12/18/2008 (3:41 pm)
Okay, here is a pending-approval resource which makes several significant improvements to GuiMLTextEditCtrl.i haven't yet merged it into a truly stock codebase, but it should be allright.
anyhow,
1.3.5 / 1.4 GuiMLTextEditCtrl shortcomings:
-------------------------------------------
* text could only be selected with mouse, not with arrow keys.
* poor cursor movement support (no ctrl-home, ctrl-end, to say nothing of shift-ctrl-home).
* no undo.
* non-blinking cursor.
* up- and down-arrow keys move cursor to beginning of line.
(this seems fixed in TGE 1.5.2)
So here are the improvements:
-----------------------------
* text can now be selected by holding shift and using the arrow keys.
also works with home, end, and shift-home and shift-end.
* added an undo and redo system, with 500-step history buffer.
(this is a more sophisticated undo/redo than in GuiTextEditCtrl)
* added ctrl-A = select all.
* added ctrl-insert = copy and shift-insert = paste.
* improved arrow-key navigation.
* improved cursor alignment with text characters.
* cursor now blinks.
* changed TAB and shift-TAB to do the regular focus-switching thing
instead of actually inserting spaces into the text.
* refactored away some code duplication,
as well as allowing more flexible key-modifiers like ctrl+shift.
* use proper modifier key on Mac.
(this may not compile in stock TGE, pls. let me know)
while i'm on the topic,
this control seems to have suffered some setbacks in TGE 1.5.
here's a quick console command you can use to try this out:
canvas.setContent(new GuiButtonCtrl(foo)); foo.add(new GuiMLTextEditCtrl() { text="blah"; } );with a GuiMLTextEditCtrl added in the stock TGE 1.5 demo executable,* the cursor is one character to the left of where it should be.
* .. which makes it sometimes appear at the end of the previous line.
* if you right-arrow in a line, then up-arrow, then down-arrow, the cursor has moved left.
* the insertion point can sometimes get wildly off from the cursor:
start a new line, enter a few characters, then pres ctrl-L a few times.
the cursor moves to the right, the text-insertion point does not.
when in this state, using the mouse to highlight text produces some truly strange behaviour.
Associate Orion Elenzil
Real Life Plus
i'm looking at TGE 1.4.
has this stuff since been added ?
i'm happy to add it, but would prefer to avoid duplicating someone else's work.
modulo the known issues around GG search,
i don't see any pertinent resources.