Create TableView at runtime

I've subclassed a TMSFMXTableViewEx:

  TMyTableView = class(TTMSFMXTableViewEx)
    constructor Create(AOwner: TComponent); reintroduce;

constructor TMyTableView.Create(AOwner: TComponent);
  inherited Create(AOwner);
  Parent := TTMSFMXBaseControl(AOwner);
  StyleName := 'TMSFMXTableViewStyle'; //TForm(AOwner).StyleBook.StyleName;
  Align := TAlignLayout.Client;
  DisableFocusEffect := False;
  TabOrder := 1;
  CanFocus := True;
  AutoFilter := False;
  AutoDeleteItem := False;
  AutoLoadBuffer := False;
  AutoLookup := False;
  AutoToggleDetail := True;
  ScrollIndicator := siPermanent;
  LookupBar := False;
  ShowFilterOnSwipe := False;
  MarkText := 'Mark';
  MoveText := 'Move';
  ArchiveText := 'Archive';
  ItemOptions := [ioCenterRectangle, ioRightRectangle, ioDetailRectangle, ioCaptionElement, ioDescriptionElement];
  FMaxLabRadWidth := 0;
//  OnItemCustomize := TrackViewItemCustomize;

When I create the host form:

procedure TfrmTrack.FormCreate(Sender: TObject);
  FMyTableView := TMyTableView.Create(Self);

...nothing happens! I just get a blank white form! The form has a tstylebook with only a default style.

What needs to be done to initialize/display the tableview?

Please read the following tip on how to subclass:

The tip is applied to TTMSFMXGrid but can be applied to any styleable control, simply replace grid with tableview

  1. Home
  3. ERROR 404

Sorry, the page you are looking for does not exist.

You can perform a website search or return to the home page.
This link works here: 

The link works but the method when implemented exactly as displayed except for the tableview makes no difference. Is some sort of customization required? Again, I'm not customizing anything via styles, just using the default. If I didn't have to use styles at all that would be vastly preferable.


This is a requirement for inheriting from styled controls. You always need to return the default style. if you keep experiencing issues using this approach you can contact us directly by email and send us your test project. There is something simple missing that shows a blank TTMSFMXTableView.

Emailed a test project illustrating the problem to

When inheriting from TTMSFMXTableView, the code will work correctly. When inheriting from TTMSFMXTableViewEx, there is an additional level, so the style needs to be retrieved from the root TTMSFMXTableView class so the code need to change to:

  1. function TMyTableView.GetClassStyleName: String;  
  2. begin  
  3.   Result := ClassParent.ClassParent.ClassName + ''style'';  
  4.   Delete(Result, 11);  
  5. end;  

Pieter Scheldeman2016-09-05 09:08:28

Thank you for clearing that up. That was the issue!

Thanks again.