Recent

Author Topic: Difference between TSpeedButton and TButton in relation to TStringGrid.OnValidat  (Read 493 times)

Hansvb

  • Hero Member
  • *****
  • Posts: 595
Hi,

If you change a cell in a TStringGrid and then click directly on a TSpeedButton, StringGrid.Onvalidate will not be called. If you click directly on a TButton after changing a cell, StringGrid.Onvalidate will be called.
Why is that difference? (Windows, Lazarus 2.2.6)

zeljko

  • Hero Member
  • *****
  • Posts: 1583
    • http://wiki.lazarus.freepascal.org/User:Zeljan
TButton is TWinControl, TSpeedButton is TGraphicControl. That's main difference. First one contains system handle and that's why it steals focus when you click on it, and triggers OnValidate event.

Zoran

  • Hero Member
  • *****
  • Posts: 1820
    • http://wiki.lazarus.freepascal.org/User:Zoran
Unlike TButton, TSpeedButton is not a window control (meaning it cannot have focus).
So, I believe that it is the reason for behaviour you describe -- SpeedButton does not steal focus from the cell, the grid keeps the focus, so the grid event is not called.

Željko was the first :)

Hansvb

  • Hero Member
  • *****
  • Posts: 595
Aha now it is clear for me.
Thanks.

 

TinyPortal © 2005-2018