Recent

Author Topic: [revisited] triple click  (Read 4118 times)

cdbc

  • Hero Member
  • *****
  • Posts: 2722
    • http://www.cdbc.dk
Re: [revisited] triple click
« Reply #15 on: March 10, 2026, 10:45:25 am »
Hi Davo
Sorry mate -- I have to report, that the interface solution doesn't work either, prolly on account of the samme /mischief/ Thaddy mentioned above...
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

dbannon

  • Hero Member
  • *****
  • Posts: 3777
    • tomboy-ng, a rewrite of the classic Tomboy
Re: [revisited] triple click
« Reply #16 on: March 10, 2026, 11:42:31 am »
OK, thats rather cute by the sound of it. From what Thaddy says, its safe to apply this technique, I'm happy to take his word for it, I have to confess that I don't understand whats happening.

So, for now, I will just disable that check, honestly, its never picked up a real fault for me, so, small risk. If no more suggestion in a few days, I'll put in a bug report. Quoting Thaddy (unless he puts in a report before then).

Thanks for the help !

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

avk

  • Hero Member
  • *****
  • Posts: 826
Re: [revisited] triple click
« Reply #17 on: March 10, 2026, 12:25:51 pm »
There is another funny trick
Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, Grids;
  9.  
  10. type
  11.  
  12.   TStringGrid = class(Grids.TStringGrid)
  13.   public
  14.     property OnTripleClick;
  15.   end;  
  16.  
  17.   { TForm1 }
  18.  
  19.   TForm1 = class(TForm)
  20.     StringGrid1: TStringGrid;
  21.     procedure FormCreate(Sender: TObject);
  22.     procedure StringTripleClick(Sender: TObject);
  23.   private
  24.  
  25.   public
  26.  
  27.   end;
  28.  
  29. var
  30.   Form1: TForm1;
  31.  
  32. implementation
  33.  
  34. {$R *.lfm}
  35.  
  36. { TForm1 }
  37.  
  38. procedure TForm1.FormCreate(Sender: TObject);
  39. begin
  40.   stringgrid1.controlstyle := stringgrid1.controlstyle + [csTripleClicks];
  41.   StringGrid1.OnTripleClick := @StringTripleClick;
  42. end;
  43.  
  44. procedure TForm1.StringTripleClick(Sender: TObject);
  45. begin
  46.    Showmessage('triple');
  47. end;
  48.  
  49. end.
  50.  

Thaddy

  • Hero Member
  • *****
  • Posts: 18944
  • Glad to be alive.
Re: [revisited] triple click
« Reply #18 on: March 10, 2026, 01:08:40 pm »
That seems to pass -CR while essentially a variation on the previous.
Nice and even cleaner..

« Last Edit: March 10, 2026, 01:15:31 pm by Thaddy »
Recovered from removal of tumor in tongue following tongue reconstruction with a part from my leg.

etrusco

  • New Member
  • *
  • Posts: 21
Re: [revisited] triple click
« Reply #19 on: March 12, 2026, 06:24:22 am »
There`s another cleaner option: helpers! I learned this "hack" in the LCL code.

Code: Pascal  [Select][+][-]
  1. type
  2.  
  3.   { TTripleClickHelper }
  4.  
  5. TTripleClickHelper = class helper for TCustomControl
  6.   procedure SetOnTripleClick(const aHandler: TNotifyEvent);
  7. end;
  8.  
  9. procedure TTripleClickHelper.SetOnTripleClick(const aHandler: TNotifyEvent);
  10. begin
  11.   ControlStyle:= ControlStyle + [csTripleClicks];
  12.   OnTripleClick := aHandler;
  13. end;
  14.  

dbannon

  • Hero Member
  • *****
  • Posts: 3777
    • tomboy-ng, a rewrite of the classic Tomboy
Re: [revisited] triple click
« Reply #20 on: March 12, 2026, 07:32:19 am »
There is another funny trick

Indeed AVK, that works perfectly, and even I can understand how it works, how good is that ?

Works in the test app, works in my real app -
https://github.com/tomboy-notes/tomboy-ng/commit/1e80daf5fb67bcf0c8e0482b92c52c840c58e4e6

I thank you (and the other very positive contributions here).

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

dbannon

  • Hero Member
  • *****
  • Posts: 3777
    • tomboy-ng, a rewrite of the classic Tomboy
Re: [revisited] triple click
« Reply #21 on: March 12, 2026, 07:45:14 am »
There`s another cleaner option: helpers! I learned this "hack" in the LCL code.

Hey, thanks etrusco, that too looks like it would work but I have not tested it. To my eyes, AVK's model is the easiest to understand and does not, so far, have any down sides. But thanks anyway !

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

 

TinyPortal © 2005-2018