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
Create a new custom tableview descending from TTMSFMXTableView or TTMSFMXTableViewEx

When you create a new TableView that descends from our TTMSFMXTableView control, make sure that in the new class, you override the protected method GetDefaultStyleLookupName to ensure your new TableView control uses the base class TTMSFMXTableView default style resource. Sample code:
  TTMSFMXTableViewEx = class(TTMSFMXTableView)
  private
    { Private declarations }
  protected
    { Protected declarations }
    function GetDefaultStyleLookupName: string; override;
    function GetClassStyleName: String; override;
  public
    { Public declarations }
    procedure ApplyStyle; override;
  published
    { Published declarations }
  end;

function TTMSFMXTableViewEx.GetClassStyleName: String;
begin
  Result := ClassParent.ClassName + ''style'';
  Delete(Result, 1, 1);
end;

function TTMSFMXTableViewEx.GetDefaultStyleLookupName: string;
begin
  Result := GetClassStyleName;
end;
Otherwise the style resource won''t be found for the new descending TableView control and it will appear empty. When inheriting from TTMSFMXTableViewEx, please make sure you always redirect the style to the root TTMSFMXTableView:
function TTMSFMXTableViewEx.GetClassStyleName: String;
begin
  Result := ClassParent.ClassParent.ClassName + ''style'';
  Delete(Result, 1, 1);
end;