Hi, how can I edit the TMSFMXTableView back button caption?
Guido
You can either do this at design time via the custom style editor and modify the style under TMSFMXTableView1Style.header.headertext.headerbackbutton.text or you can do this programmatically via (TMSFMXTableView.GetBackButton as TTMSFMXBarButton).Text
but if i do (TMSFMXTableView.GetBackButton as TTMSFMXBarButton).Text i have an access violation because GetBackButton return nil object ...
I suppose you do this before the style is created. Please do this from the TMSFMXTableView.OnApplyStyleLookup event
If I use OnApplyStyleLookup event, nothing is happening.
GetBackButton not return nil anymore but no backbutton text changes, no exceptions...
Else if I use OnPaint event works perfectly. very weird...
Hi,
Please do not use the OnPaint event to change properties. Changing properties will cause a repaint and possibly end up in a endless while loop. The code to change the back button text is:
procedure TForm1.TMSFMXTableView1ApplyStyleLookup(Sender: TObject);
var
b: TTMSFMXBarButton;
begin
b := TMSFMXTableView1.GetBackButton as TTMSFMXBarButton;
b.AllowCustomize := True;
end;
procedure TForm1.TMSFMXTableView1ItemBeforeDetail(Sender: TObject;
AItem: TTMSFMXTableViewItem);
var
b: TTMSFMXBarButton;
begin
b := TMSFMXTableView1.GetBackButton as TTMSFMXBarButton;
b.Text := 'test';
b.Layout := slPointer;
end;
Thank you!