Frequently Asked Component Specific Questions
Options |
Display all FAQ items |
Displaying items 1 to 1 of 1, page 1 of 1
<< previous next >>
TMS FMX UI Pack
TTMSFMXGrid: How to show/popup a comment by clicking on a cell
TTMSFMXGrid: How to show/popup a comment by clicking on a cell
To show a Popup with the cell comments you can use following code:
procedure TForm1.FormCreate(Sender: TObject); begin TMSFMXGrid1.Comments[3, 3] := ''Hello''#13#10''World''; end; procedure TForm1.TMSFMXGrid1CellClick(Sender: TObject; ACol, ARow: Integer); var obj: TControl; begin obj := TMSFMXGrid1.GetCellObject(Cell(ACol, ARow)); if Assigned(obj) and (obj is TTMSFMXCommentGridCell) then (obj as TTMSFMXCommentGridCell).ShowPopup; end;
procedure TForm1.TMSFMXGrid1GetCellProperties(Sender: TObject; ACol, ARow: Integer; Cell: TFmxObject); begin if Cell is TTMSFMXCommentGridCell then begin (Cell as TTMSFMXCommentGridCell).CommentPanel.CalloutPosition := TCalloutPosition.Top; (Cell as TTMSFMXCommentGridCell).Popup.Placement := TPlacement.BottomCenter; (Cell as TTMSFMXCommentGridCell).CommentText.Margins.Top := (Cell as TTMSFMXCommentGridCell).CommentPanel.CalloutLength + 2; end; end;