Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TMS FMX UI Pack
TTMSFMXTableView: How to change the text of the 'Edit' button depending you're in edit mode or not + how to remove the 'Move' button

Below is a small sample that demonstrates how your can change the text of the ''Edit'' button depending you''re in edit mode or not + how you can remove the ''Move'' button.
procedure TForm136.ChangeEditButton(AEditButton: TTMSFMXBarButton);
begin
  if TMSFMXTableView1.isEditMode then
    AEditButton.Text := ''Hello''
  else
    AEditButton.Text := ''World'';
end;

procedure TForm136.EditClick(Sender: TObject);
begin
  if TMSFMXTableView1.isEditMode then
    TMSFMXTableView1.CancelEditMode
  else
    TMSFMXTableView1.EditMode;

  ChangeEditButton((Sender as TTMSFMXBarButton));
end;

procedure TForm136.TMSFMXTableView1ApplyStyleLookup(Sender: TObject);
var
  b: TTMSFMXBarButton;
begin
  b := TMSFMXTableView1.GetEditButton as TTMSFMXBarButton;
  (b as TTMSFMXBarButton).OnClick := EditClick;
  (b as TTMSFMXBarButton).AllowCustomize := True;
  ChangeEditButton(b);
  TMSFMXTableView1.GetMoveButton.Visible := False;
  TMSFMXTableView1.GetMarkButton.Align := TAlignLayout.alClient;
  TMSFMXTableView1.GetArchiveButton.Align := TAlignLayout.alLeft;
  TMSFMXTableView1.GetArchiveButton.Width := (TMSFMXTableView1.Width - (TMSFMXTableView1.GetArchiveButton.Margins.Right * 5)) / 2
end;