TMSFMXTableView adding buttons and a details area

Hello,

is it possible and if yes how, to add 3 right aligned buttons to thze TMSFMX table view?
They should only be visible on the selected item (no multiselect) and be right aligned.
Clicking them different things shall happen. One of these buttons shall on click "expand" the selected item so that some space for displaying several rows of text (something like a 2 column table) is made available.

When a different item is being selected the expanded space has to be removed, so the now deselected item becomes "normal" again.

Hi,


You need to add buttons to the default item, that are initially invisible. You can access the default item in the stylebook. Alternatively you can use the following code:

procedure TForm51.TMSFMXTableView1ItemCustomize(Sender: TObject;
  AItem: TTMSFMXTableViewItem; AItemShape: TTMSFMXTableViewItemShape;
  AItemControlShape: TControl);
var
  b: TButton;
begin
  b := TButton.Create(Self);
  b.Align := TAlignLayout.Right;
  b.Margins.Left := 10;
  b.Margins.Top := 10;
  b.Margins.Right := 10;
  b.Margins.Bottom := 10;
  b.StyleName := 'itembutton' + AItem.Index.ToString;
  b.Visible := aItem.Selected;
  AItemShape.AddObject(b);
end;

procedure TForm51.TMSFMXTableView1ItemSelected(Sender: TObject;
  AItem: TTMSFMXTableViewItem);
var
  s: TTMSFMXTableViewItemShape;
  c: TComponent;
  I: Integer;
begin
  for I := 0 to TMSFMXTableView1.Items.Count - 1 do
  begin
    s := TMSFMXTableView1.Items.Shape;
    if Assigned(s) then
    begin
      c := s.FindStyleResource('itembutton' + I.ToString);
      if Assigned(c) and (c is TButton) then
      begin
        (c as TButton).Visible := TMSFMXTableView1.Items.Selected;
      end;
    end;
  end;
end;

Thanks for this solution approach. In the mean time I managed to implement the functionality I want using a standard FMX TListBiox. There you can add buttons in the OnCHange event.