Skip to content

KGrid: AEditor as TButton always visible #51

Answered by kryslt
awunnenb asked this question in Q&A
Discussion options

You must be logged in to vote

The only way is drawing button frame in the cells and then create a working TButton in OnEditorCreate.
Example for a graphic button frame:

procedure TForm.TKGridDrawCell(Sender: TObject; ACol, ARow: Integer;
  R: TRect; State: TKGridDrawState);
var
  G: TKGrid;
  Bounds, Interior: TRect;
begin
  G := Sender As TKGrid;
  G.CellPainter.Graphic := FGraphic; // some typical graphic for a close button
  G.CellPainter.DrawDefaultCellBackground;
  G.CellPainter.DrawButtonFrame(R);
  G.CellPainter.CellGraphicRect(R, Bounds, Interior, stmNone);
  G.CellPainter.DrawCellGraphic(Bounds, Interior);
end;

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kryslt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question The issue is a question
2 participants
Converted from issue

This discussion was converted from issue #41 on February 08, 2024 10:36.