View Issue Details

IDProjectCategoryView StatusLast Update
0029084LazarusLCLpublic2015-12-02 13:35
ReporterEgan SoloAssigned ToBart Broersma 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformIntelOSWindowsOS Version10
Product Version1.4.4Product Build 
Target Version1.6Fixed in Version1.6 
Summary0029084: Left and right Arrows keys do not work as intended when TValueListEditor is in edit mode
DescriptionWhen editing a field in TValueListEditor, the left and right key move the focus from one cell to another instead of moving the cursor from one character to the next.
Steps To Reproduce1. Start Lazarus.
2. Create a new project and select Application.
3. Drop a TValueListEditor on the main form.
4. Open the Object Inspector if it is not already open.
5. Click on the button of the Strings field. This opens up the TValueListEditor in an editor window to allow you to key in keys and values.
6. Click inside the Name column
7. Type in Hello world.
8. Hit the right arrow key. The focus moves to the Key column
9. Click the first cell of the Name Column again.Make sure the cursor is before the end of the "Hello World" string.
10. click on the right arrow. You will see that no change occurs. The cursor does not move right.
Additional InformationThis happens only in the TValueListEditor. The TStringGrid does not have this issue.
TagsNo tags attached.
Fixed in Revisionr50566
LazTarget1.6
Widgetset
Attached Files
  • valedit.editorkeys.diff (1,636 bytes)
    Index: lcl/valedit.pas
    ===================================================================
    --- lcl/valedit.pas	(revision 50494)
    +++ lcl/valedit.pas	(working copy)
    @@ -1190,7 +1190,10 @@
       end;
       Result:=inherited GetDefaultEditor(Column);
       //Need this to be able to intercept VK_Delete in the editor
    -  EditorOptions := EditorOptions or EO_HOOKKEYDOWN;
    +  if (KeyDelete in KeyOptions) then
    +    EditorOptions := EditorOptions or EO_HOOKKEYDOWN
    +  else
    +    EditorOptions := EditorOptions and (not EO_HOOKKEYDOWN);
       if Column=1 then
       begin
         ItemProp := nil;
    Index: lcl/grids.pas
    ===================================================================
    --- lcl/grids.pas	(revision 50494)
    +++ lcl/grids.pas	(working copy)
    @@ -6898,15 +6898,23 @@
           end else
             TabCheckEditorKey;
         VK_LEFT:
    -      if Relaxed then
    -        MoveSel(True, -cBidiMove[UseRightToLeftAlignment], 0)
    -      else
    -        MoveSel(True, 0,-1);
    +      //Don't move to another cell is user is editing
    +      if not FEditorKey then
    +      begin
    +        if Relaxed then
    +          MoveSel(True, -cBidiMove[UseRightToLeftAlignment], 0)
    +        else
    +          MoveSel(True, 0,-1);
    +      end;
         VK_RIGHT:
    -      if Relaxed then
    -        MoveSel(True, cBidiMove[UseRightToLeftAlignment], 0)
    -      else
    -        MoveSel(True, 0, 1);
    +      //Don't move to another cell is user is editing
    +      if not FEditorKey then
    +      begin
    +        if Relaxed then
    +          MoveSel(True, cBidiMove[UseRightToLeftAlignment], 0)
    +        else
    +          MoveSel(True, 0, 1);
    +      end;
         VK_UP:
             MoveSel(True, 0, -1);
         VK_DOWN:
    
    valedit.editorkeys.diff (1,636 bytes)

Activities

Bart Broersma

2015-11-25 17:48

developer  

valedit.editorkeys.diff (1,636 bytes)
Index: lcl/valedit.pas
===================================================================
--- lcl/valedit.pas	(revision 50494)
+++ lcl/valedit.pas	(working copy)
@@ -1190,7 +1190,10 @@
   end;
   Result:=inherited GetDefaultEditor(Column);
   //Need this to be able to intercept VK_Delete in the editor
-  EditorOptions := EditorOptions or EO_HOOKKEYDOWN;
+  if (KeyDelete in KeyOptions) then
+    EditorOptions := EditorOptions or EO_HOOKKEYDOWN
+  else
+    EditorOptions := EditorOptions and (not EO_HOOKKEYDOWN);
   if Column=1 then
   begin
     ItemProp := nil;
Index: lcl/grids.pas
===================================================================
--- lcl/grids.pas	(revision 50494)
+++ lcl/grids.pas	(working copy)
@@ -6898,15 +6898,23 @@
       end else
         TabCheckEditorKey;
     VK_LEFT:
-      if Relaxed then
-        MoveSel(True, -cBidiMove[UseRightToLeftAlignment], 0)
-      else
-        MoveSel(True, 0,-1);
+      //Don't move to another cell is user is editing
+      if not FEditorKey then
+      begin
+        if Relaxed then
+          MoveSel(True, -cBidiMove[UseRightToLeftAlignment], 0)
+        else
+          MoveSel(True, 0,-1);
+      end;
     VK_RIGHT:
-      if Relaxed then
-        MoveSel(True, cBidiMove[UseRightToLeftAlignment], 0)
-      else
-        MoveSel(True, 0, 1);
+      //Don't move to another cell is user is editing
+      if not FEditorKey then
+      begin
+        if Relaxed then
+          MoveSel(True, cBidiMove[UseRightToLeftAlignment], 0)
+        else
+          MoveSel(True, 0, 1);
+      end;
     VK_UP:
         MoveSel(True, 0, -1);
     VK_DOWN:
valedit.editorkeys.diff (1,636 bytes)

Bart Broersma

2015-11-25 17:49

developer   ~0087586

Can you test with attached patch (valedit.editorkeys.diff)?

Bart Broersma

2015-12-02 13:35

developer   ~0087748

Please test and close if OK.

Issue History

Date Modified Username Field Change
2015-11-25 00:53 Egan Solo New Issue
2015-11-25 00:54 Bart Broersma Assigned To => Bart Broersma
2015-11-25 00:54 Bart Broersma Status new => assigned
2015-11-25 17:48 Bart Broersma File Added: valedit.editorkeys.diff
2015-11-25 17:49 Bart Broersma LazTarget => -
2015-11-25 17:49 Bart Broersma Note Added: 0087586
2015-11-25 17:49 Bart Broersma Status assigned => feedback
2015-12-02 13:35 Bart Broersma Fixed in Revision => r50566
2015-12-02 13:35 Bart Broersma LazTarget - => 1.6
2015-12-02 13:35 Bart Broersma Note Added: 0087748
2015-12-02 13:35 Bart Broersma Status feedback => resolved
2015-12-02 13:35 Bart Broersma Fixed in Version => 1.6
2015-12-02 13:35 Bart Broersma Resolution open => fixed
2015-12-02 13:35 Bart Broersma Target Version => 1.6