View Issue Details

IDProjectCategoryView StatusLast Update
0028074LazarusDatabase Componentspublic2015-05-15 20:18
ReporterSimon AmeisAssigned ToJesus Reyes 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version1.5 (SVN)Product Build48639 
Target Version1.6Fixed in Version1.5 (SVN) 
Summary0028074: TDBGrid's event OnEditButtonClick is not called if line is not selected
DescriptionOnEditButtonClick event should be called on each click on a DBGrid's edit button. It shouldn't matter which row is currently selected.
Steps To Reproduce

  1. Place a DBGrid with datasource etc. on a form

  2. Add columns to the grid, set one column's ButtonStyle property to cbsButtonColumn

  3. When running the application, you shoud see the buttons in each line in the grid

  4. Clicking on one button of a not selected row selects the row but doesn't call OnEditButtonClick evnt

Tagsdbgrid, patch
Fixed in Revision49033
LazTarget1.6
WidgetsetWin32/Win64
Attached Files
  • dbgrid_button_click.patch (409 bytes)
     lcl/dbgrids.pas | 1 +
     1 file changed, 1 insertion(+)
    
    diff --git a/lcl/dbgrids.pas b/lcl/dbgrids.pas
    index 713a502..26dbd52 100644
    --- a/lcl/dbgrids.pas
    +++ b/lcl/dbgrids.pas
    @@ -2553,6 +2553,7 @@ begin
                 if InsertCancelable and IsEOF then
                   doCancel;
                 doMoveBy;
    +            doInherited;
               end;
               if ssCtrl in Shift then
                 ToggleSelectedRow
    

Activities

Simon Ameis

2015-05-11 23:18

reporter  

dbgrid_button_click.patch (409 bytes)
 lcl/dbgrids.pas | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lcl/dbgrids.pas b/lcl/dbgrids.pas
index 713a502..26dbd52 100644
--- a/lcl/dbgrids.pas
+++ b/lcl/dbgrids.pas
@@ -2553,6 +2553,7 @@ begin
             if InsertCancelable and IsEOF then
               doCancel;
             doMoveBy;
+            doInherited;
           end;
           if ssCtrl in Shift then
             ToggleSelectedRow

Simon Ameis

2015-05-11 23:21

reporter   ~0083568

Please see attached file dbgrid_button_click.patch

With this call to inherited TCustomGrid.MouseDown sets the field fGridState to gsButtonColumnClicking which then can be checked in TCustomGrid.MouseUp.

Jesus Reyes

2015-05-15 20:18

developer   ~0083623

Thanks, I Implemented an alternative that do not call OnMouseDown twice.
Please test.

Issue History

Date Modified Username Field Change
2015-05-11 22:33 Simon Ameis New Issue
2015-05-11 22:36 Jesus Reyes Assigned To => Jesus Reyes
2015-05-11 22:36 Jesus Reyes Status new => assigned
2015-05-11 23:18 Simon Ameis File Added: dbgrid_button_click.patch
2015-05-11 23:19 Simon Ameis Tag Attached: patch
2015-05-11 23:19 Simon Ameis Tag Attached: dbgrid
2015-05-11 23:21 Simon Ameis Note Added: 0083568
2015-05-15 20:18 Jesus Reyes Fixed in Revision => 49033
2015-05-15 20:18 Jesus Reyes LazTarget => 1.6
2015-05-15 20:18 Jesus Reyes Note Added: 0083623
2015-05-15 20:18 Jesus Reyes Status assigned => resolved
2015-05-15 20:18 Jesus Reyes Fixed in Version => 1.5 (SVN)
2015-05-15 20:18 Jesus Reyes Resolution open => fixed
2015-05-15 20:18 Jesus Reyes Target Version => 1.6