Tips and Frequently Asked Questions

  Adding an UIToolBarItem to the toolbar of an UITableView in iCL


The TTMSFMXNativeUITableView has a toolbar property that can be set to True. When adding an item, you can then add it to the TableViewController instead of the NavigationController. Below is the source code that demonstrates this.

unit UDemo;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, iOSApi.Foundation,
  FMX.TMSNativeUIBaseControl, FMX.TMSNativeUIView, FMX.TMSNativeUICore,
  FMX.TMSNativeUIViewController, FMX.TMSNativeUINavigationController, FMX.TMSNativeUIToolBar,
  MacApi.ObjectiveC, TypInfo, MacApi.ObjcRuntime, FMX.TMSNativeUITableView;

type
  IUIToolBarButtonEventHandler = interface(NSObject)
  ['{1ACF3DFA-A90B-4F06-ACF1-8A40076BC9ED}']
    procedure Click(Sender: Pointer); cdecl;
  end;

  TUIToolBarButtonEventHandler = class(TOCLocal)
  protected
    function GetObjectiveCClass: PTypeInfo; override;
  public
    procedure Click(Sender: Pointer); cdecl;
  end;

  TDemoForm = class(TForm)
    TMSFMXNativeUITableView1: TTMSFMXNativeUITableView;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
    FEventHandler: TUIToolBarButtonEventHandler;
    FHideButton: UIBarButtonItem;
  public
    { Public declarations }
  end;

var
  DemoForm: TDemoForm;

implementation

{$R *.fmx}

procedure TDemoForm.FormCreate(Sender: TObject);
begin
  FEventHandler := TUIToolBarButtonEventHandler.Create;
  FHideButton := TUIBarButtonItem.Wrap(TUIBarButtonItem.Wrap(TUIBarButtonItem.OCClass.alloc).initWithBarButtonSystemItem(integer(siBarButtonSystemItemAdd),
    FEventHandler.GetObjectID, sel_getUid('Click:')));

  TMSFMXNativeUITableView1.Options.ToolBar := True;
  TMSFMXNativeUITableView1.TableViewController.navigationItem.setRightBarButtonItem(FHideButton);
end;

{ TUIToolBarButtonEventHandler }

procedure TUIToolBarButtonEventHandler.Click(Sender: Pointer);
begin
  ShowMessage('clicked');
end;

function TUIToolBarButtonEventHandler.GetObjectiveCClass: PTypeInfo;
begin
  Result := TypeInfo(IUIToolBarButtonEventHandler);
end;

end.





Pricing

Single Developer License Small Team License Site License
 

TMS iCL


€ 125

75 yearly renewal
license for 1 developer


Includes
check  Full source code
check  Access to the TMS Support Center
check  Free updates and new releases
BEST VALUE

TMS ALL-ACCESS


€ 1,795

575 yearly renewal
license for 1 developer


Includes
check  Full source code
check  Access to the TMS Support Center
check  Free updates and new releases
check  TMS iCL
check  All TMS FMX products
check  All TMS products
more_horiz  Discover more
All prices excl. VAT. Renewal price is subject to change and only valid up to 30 days after license has expired. After renewal period a discount price is offered to renew the license.

TMS ALL-ACCESS

key
Get unlimited access to all TMS products
local_offer
One money and time saving bundle

Free Trial

Start a free TMS iCL evaluation today!
RAD Studio

What our customers say

As a developer for 30+ years, and a Delphi developer since 1996, I've a solid foundation on desktop development. But I was skeptical of indulging in web development. Though the market was demanding a switch, it seemed too difficult to make the transition. TMS Software was my "magic bullet" to get me started with zero intimidation. Love their Web Core and XData products. Now I can develop powerful web applications using Delphi. TMS Software has renewed my love for Delphi and won my heart for their innovators. Thanks to the team for great products and a large volume of demos and manuals. You ROCK!

- Larry

In the past I have purchased other components from other parties. I will say proudly that TMS is the best in support, price and style. Whenever I need a help your team is always there to help me. Keep up the good work

- Mohamed Thooloon

Hi Bruno Just want to drop you a line about how great your presentation was today. We often fail to point out to someone when they do a great job! You did a great job, you gave me a lot of ideas, and you answered my question very well. THANK you for your great products & super support.

- Lawrence Green

Thank you for developing components where I can best describe it like this: TMS components is a case where "The wheels fit the car, and NOT the car fit the wheels". Well done.

- Sathiparsad

As always your support is extraordinary and lightning fast.

-

TMS FNC UI Pack

extensions
Full compatibility with VCL, FireMonkey and TMS WEB Core
electric_bolt
Single high-performance multi-platform codebase