Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Is a TButton in the header of VirtualStringTree possible? (https://www.delphipraxis.net/205207-tbutton-header-virtualstringtree-possible.html)

softtouch 12. Aug 2020 09:14


Is a TButton in the header of VirtualStringTree possible?
 
I need a button in the header of the virtualstringtree, or a way to know about when the icon in the header is clicked, but I cant find anything in google or in the source about such thing. Is this possible at all?

KodeZwerg 12. Aug 2020 09:37

AW: Is a TButton in the header of VirtualStringTree possible?
 
There's an Topic with same content on Stackoverflow. Here is the link. Does that solve your question?

Aviator 12. Aug 2020 09:49

AW: Is a TButton in the header of VirtualStringTree possible?
 
Why don't you simply use the OnHeaderClick Event? There you have a HitInfo parameter which provides you the position where the user clicked on.

Delphi-Quellcode:
procedure TfrmMain.vstHeaderClick(Sender: TVTHeader; HitInfo: TVTHeaderHitInfo);
begin
  if (HitInfo.HitPosition = hhiOnIcon) then begin
    // Do something here
  end;
end;

Pro tip: Check out the VirtualTreeView source code. This is the best documentation you can get. Or simply ask here if you don't know how to do it. :)

Delphi-Quellcode:
  // Structure used when info about a certain position in the header is needed.
  TVTHeaderHitInfo = record
    X,
    Y: Integer;
    Button: TMouseButton;
    Shift: TShiftState;
    Column: TColumnIndex;
    HitPosition: TVTHeaderHitPositions;
  end;

  // These flags are used to indicate where a click in the header happened.
  TVTHeaderHitPosition = (
    hhiNoWhere,        // No column is involved (possible only if the tree is smaller than the client area).
    hhiOnColumn,       // On a column.
    hhiOnIcon,         // On the bitmap associated with a column.
    hhiOnCheckbox      // On the checkbox if enabled.
  );
  TVTHeaderHitPositions = set of TVTHeaderHitPosition;


Alle Zeitangaben in WEZ +1. Es ist jetzt 04:58 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz