View Issue Details

IDProjectCategoryView StatusLast Update
0015833LazarusLCLpublic2011-12-01 11:24
ReporterOlegAssigned ToJesus Reyes 
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionfixed 
Product Version0.9.29 (SVN)Product Build 
Target VersionFixed in Version0.9.29 (SVN) 
Summary0015833: grid improvement (inplace editing of cell values with picklisteditor and stringeditor)
Descriptionthere are two improvements
1. there was no check for "EditorIsReadOnly" when accepting text from stringselleditor in the way i found it in TPickListCellEditor.Select method, so i moved the
    if FGrid.EditorIsReadOnly then
      exit;
block to TCustomStringGrid.SetEditText so that it works similar with celleditors of all types

2. when typing test into picklist's combo (using it like stringeditor instead of selecting a value from a list) the value passed to ValidateEntry was not the typed value, but the last selected from the picklist, although the value of the cell was really set to the typed value - so validation could not be performed correctly.
Tagsgrids
Fixed in Revision27317
LazTarget-
Widgetset
Attached Files
  • grids_picklist_change.patch (1,668 bytes)
    Index: grids.pas
    ===================================================================
    --- grids.pas	(revision 23755)
    +++ grids.pas	(working copy)
    @@ -223,6 +223,7 @@
         procedure DropDown; override;
         procedure CloseUp; override;
         procedure Select; override;
    +    procedure Change; override;
         procedure msg_GetValue(var Msg: TGridMessage); message GM_GETVALUE;
         procedure msg_SetGrid(var Msg: TGridMessage); message GM_SETGRID;
         procedure msg_SetValue(var Msg: TGridMessage); message GM_SETVALUE;
    @@ -9001,12 +9002,15 @@
     
     procedure TCustomStringGrid.SetEditText(aCol, aRow: Longint; const aValue: string);
     begin
    -  GridFlags := GridFlags + [gfEditorUpdateLock];
    -  try
    -    if Cells[aCol, aRow]<>aValue then
    -      Cells[aCol, aRow]:= aValue;
    -  finally
    -    GridFlags := GridFlags - [gfEditorUpdateLock];
    +  if not EditorIsReadOnly then
    +  begin
    +    GridFlags := GridFlags + [gfEditorUpdateLock];
    +    try
    +      if Cells[aCol, aRow]<>aValue then
    +        Cells[aCol, aRow]:= aValue;
    +    finally
    +      GridFlags := GridFlags - [gfEditorUpdateLock];
    +    end;
       end;
       inherited SetEditText(aCol, aRow, aValue);
     end;
    @@ -10174,14 +10178,20 @@
     procedure TPickListCellEditor.Select;
     begin
       if FGrid<>nil then begin
    -    if FGrid.EditorIsReadOnly then
    -      exit;
         FGrid.SetEditText(FCol, FRow, Text);
         FGrid.PickListItemSelected(Self);
       end;
       inherited Select;
     end;
     
    +procedure TPickListCellEditor.Change;
    +begin
    +  if FGrid<>nil then begin
    +    FGrid.SetEditText(FCol, FRow, Text);
    +  end;
    +  inherited Change;
    +end;
    +
     procedure TPickListCellEditor.msg_GetValue(var Msg: TGridMessage);
     begin
       Msg.Col := FCol;
    

Activities

2010-02-22 07:28

 

grids_picklist_change.patch (1,668 bytes)
Index: grids.pas
===================================================================
--- grids.pas	(revision 23755)
+++ grids.pas	(working copy)
@@ -223,6 +223,7 @@
     procedure DropDown; override;
     procedure CloseUp; override;
     procedure Select; override;
+    procedure Change; override;
     procedure msg_GetValue(var Msg: TGridMessage); message GM_GETVALUE;
     procedure msg_SetGrid(var Msg: TGridMessage); message GM_SETGRID;
     procedure msg_SetValue(var Msg: TGridMessage); message GM_SETVALUE;
@@ -9001,12 +9002,15 @@
 
 procedure TCustomStringGrid.SetEditText(aCol, aRow: Longint; const aValue: string);
 begin
-  GridFlags := GridFlags + [gfEditorUpdateLock];
-  try
-    if Cells[aCol, aRow]<>aValue then
-      Cells[aCol, aRow]:= aValue;
-  finally
-    GridFlags := GridFlags - [gfEditorUpdateLock];
+  if not EditorIsReadOnly then
+  begin
+    GridFlags := GridFlags + [gfEditorUpdateLock];
+    try
+      if Cells[aCol, aRow]<>aValue then
+        Cells[aCol, aRow]:= aValue;
+    finally
+      GridFlags := GridFlags - [gfEditorUpdateLock];
+    end;
   end;
   inherited SetEditText(aCol, aRow, aValue);
 end;
@@ -10174,14 +10178,20 @@
 procedure TPickListCellEditor.Select;
 begin
   if FGrid<>nil then begin
-    if FGrid.EditorIsReadOnly then
-      exit;
     FGrid.SetEditText(FCol, FRow, Text);
     FGrid.PickListItemSelected(Self);
   end;
   inherited Select;
 end;
 
+procedure TPickListCellEditor.Change;
+begin
+  if FGrid<>nil then begin
+    FGrid.SetEditText(FCol, FRow, Text);
+  end;
+  inherited Change;
+end;
+
 procedure TPickListCellEditor.msg_GetValue(var Msg: TGridMessage);
 begin
   Msg.Col := FCol;

Jesus Reyes

2010-09-12 00:47

developer   ~0040975

applied, sorry for delay

Issue History

Date Modified Username Field Change
2010-02-22 07:28 Oleg New Issue
2010-02-22 07:28 Oleg File Added: grids_picklist_change.patch
2010-02-22 14:53 Jesus Reyes Status new => assigned
2010-02-22 14:53 Jesus Reyes Assigned To => Jesus Reyes
2010-03-15 02:29 Jesus Reyes Tag Attached: grids
2010-09-12 00:47 Jesus Reyes Fixed in Revision => 27317
2010-09-12 00:47 Jesus Reyes LazTarget => -
2010-09-12 00:47 Jesus Reyes Status assigned => resolved
2010-09-12 00:47 Jesus Reyes Fixed in Version => 0.9.29 (SVN)
2010-09-12 00:47 Jesus Reyes Resolution open => fixed
2010-09-12 00:47 Jesus Reyes Note Added: 0040975
2011-12-01 11:24 Marc Weustink Status resolved => closed