View Issue Details

IDProjectCategoryView StatusLast Update
0015956PatchesIDEpublic2011-12-01 11:26
ReporterAttila Borka Assigned ToMattias Gaertner  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version0.9.29 (SVN) 
Target Version0.9.30 
Summary0015956: Patch for object inspector double click handling (12021)
DescriptionThis patch fixes the issues reported in
http://bugs.freepascal.org/view.php?id=12021

I've created the patch using Douglas.ShowModal's notes for the fix in the above report.
TagsNo tags attached.
Fixed in Revision26493
LazTarget0.9.30
Widgetset
Attached Files

Relationships

parent of 0018755 acknowledged Lazarus Single-clicking on a property in the Object Inspector unintentionally increments its value. 
child of 0012021 closedMattias Gaertner Lazarus Double click activity for the property editor 
Not all the children of this issue are yet resolved or closed.

Activities

2010-03-11 03:08

 

patch.patch (3,029 bytes)   
Index: objectinspector.pp
===================================================================
--- objectinspector.pp	(revision 23932)
+++ objectinspector.pp	(working copy)
@@ -293,6 +293,7 @@
     FTopY: integer;
     FDrawHorzGridLines: Boolean;
     FActiveRowBmp: TCustomBitmap;
+    FTimerDblClick: Ttimer;
 
     // hint stuff
     FHintTimer: TTimer;
@@ -384,6 +385,8 @@
     procedure ValueComboBoxCloseUp(Sender: TObject);
     procedure ValueComboBoxGetItems(Sender: TObject);
     procedure ValueButtonClick(Sender: TObject);
+    procedure ValueControlsClick(Sender: TObject);
+    procedure TimerDblClickTimer(Sender: TObject);
     procedure ValueComboBoxMeasureItem(Control: TWinControl; Index: Integer;
           var AHeight: Integer);
     procedure ValueComboBoxDrawItem(Control: TWinControl; Index: Integer;
@@ -869,6 +872,7 @@
     Parent:=Self;
     OnMouseDown := @ValueControlMouseDown;
     OnMouseMove := @ValueControlMouseMove;
+    OnClick:= @ValueControlsClick;
     OnDblClick := @ValueEditDblClick;
     OnExit:=@ValueEditExit;
     OnChange:=@ValueEditChange;
@@ -892,6 +896,7 @@
     Parent:=Self;
     OnMouseDown := @ValueControlMouseDown;
     OnMouseMove := @ValueControlMouseMove;
+    OnClick:= @ValueControlsClick;
     OnDblClick := @ValueEditDblClick;
     OnExit:=@ValueComboBoxExit;
     //OnChange:=@ValueComboBoxChange; the on change event is called even,
@@ -936,6 +941,14 @@
 
   FActiveRowBmp := CreateBitmapFromLazarusResource('pg_active_row');
 
+  FTimerDblClick := TTimer.Create(self);
+  with FTimerDblClick do
+  begin
+     Enabled := false;
+     Interval := 400; //Time to identify a DbClick
+     OnTimer := @TimerDblClickTimer;
+  end;
+
   if DefItemHeight<3 then
     FDefaultItemHeight:=ValueComboBox.Height-3
   else
@@ -1087,6 +1100,7 @@
   FreeAndNil(FHintWindow);
   FreeAndNil(FNewComboBoxItems);
   FreeAndNil(FActiveRowBmp);
+  FreeAndNil(FTimerDblClick);
   inherited Destroy;
 end;
 
@@ -1463,6 +1477,23 @@
   DoCallEdit;
 end;
 
+procedure TOICustomPropertyGrid.ValueControlsClick(Sender: TObject);
+begin
+  if FTimerDblClick.Enabled
+  then
+    begin
+      if FCurrentEdit = ValueEdit
+        then ValueEdit.OnDblClick(ValueEdit);
+      if FCurrentEdit = ValueComboBox
+        then ValueComboBox.OnDblClick(ValueComboBox);
+    end;
+end;
+
+procedure TOICustomPropertyGrid.TimerDblClickTimer(Sender: TObject);
+begin
+  FTimerDblClick.Enabled:= false;
+end;
+
 procedure TOICustomPropertyGrid.ValueComboBoxMeasureItem(Control: TWinControl;
   Index: Integer; var AHeight: Integer);
 var
@@ -1529,9 +1560,11 @@
       ValueCheckBox.Enabled:=not NewRow.IsReadOnly;
       ValueCheckBox.Caption:=NewValue;
       ValueCheckBox.Checked:=(NewValue='True');
+      FTimerDblClick.Enabled:= true;
     end else
     {$ENDIF}
     if paValueList in EditorAttributes then begin
+      FTimerDblClick.Enabled:= true;
       FCurrentEdit:=ValueComboBox;
       if paPickList in EditorAttributes then begin
         // text field should be readonly
patch.patch (3,029 bytes)   

Zeljan Rikalo

2010-03-17 10:01

developer   ~0035692

To developers: please note that this works ok with gtk2 and qt under linux, so this patch isn't needed for all ws

Attila Borka

2010-03-18 07:21

reporter   ~0035747

Zeljan, I've just tried it on my Ubuntu with the latest Lazarus and it does not work.
Just do a double click on an object inspector True/False property when the focus is on the source code window and that property was not selected in the object inspector (ex: if you focus on the object inspector it is not that field that will have the focus) for example. It will not switch the True to False and vice versa.

Zeljan Rikalo

2010-03-18 08:22

developer   ~0035749

@Attila what widgetset ? qt or gtk 2 ?

Attila Borka

2010-03-18 09:29

reporter   ~0035753

Last edited: 2010-03-18 09:31

gtk2 is the default now for Lazarus latest SVN

It only flips the True/False field if the field is selected/focused on in the object inspector. If you just double click on the field without selecting the property first, it will not flip.

Zeljan Rikalo

2010-07-05 08:27

developer   ~0039019

Yep, qt is correct, but gtk2 not in this case.

Mattias Gaertner

2010-07-06 22:36

manager   ~0039094

Please test and if ok then please mark this bug as closed.

John Stoneham

2011-02-24 16:37

reporter   ~0046247

This patch, which was incorporated into rev 26493, breaks the object inspector under carbon. See http://bugs.freepascal.org/view.php?id=18755

Issue History

Date Modified Username Field Change
2010-03-11 03:08 Attila Borka New Issue
2010-03-11 03:08 Attila Borka File Added: patch.patch
2010-03-11 07:48 Vincent Snijders Relationship added child of 0012021
2010-03-12 16:02 Vincent Snijders LazTarget => 0.9.30
2010-03-12 16:02 Vincent Snijders Status new => acknowledged
2010-03-12 16:02 Vincent Snijders Target Version => 0.9.30
2010-03-12 16:03 Vincent Snijders Category Patch => IDE
2010-03-12 16:03 Vincent Snijders Project Lazarus => Patches
2010-03-17 10:01 Zeljan Rikalo Note Added: 0035692
2010-03-17 10:01 Zeljan Rikalo Status acknowledged => feedback
2010-03-18 07:21 Attila Borka Note Added: 0035747
2010-03-18 08:22 Zeljan Rikalo Note Added: 0035749
2010-03-18 09:29 Attila Borka Note Added: 0035753
2010-03-18 09:31 Attila Borka Note Edited: 0035753
2010-07-05 08:27 Zeljan Rikalo Note Added: 0039019
2010-07-06 22:36 Mattias Gaertner Fixed in Revision => 26493
2010-07-06 22:36 Mattias Gaertner Note Added: 0039094
2010-07-06 22:36 Mattias Gaertner Assigned To => Mattias Gaertner
2010-07-06 22:36 Mattias Gaertner Status feedback => resolved
2010-11-01 09:42 Vincent Snijders Resolution open => fixed
2011-02-24 16:37 John Stoneham Note Added: 0046247
2011-02-26 04:35 Dmitry Boyarintsev Relationship added parent of 0018755
2011-12-01 11:26 Marc Weustink Status resolved => closed