ToolBar Tool Buttons Alignment

I am trying out the ICL Pack. 


I added a NativeUIToolbar and added a couple of buttons which seems to all align to the left. Is there a way to align buttons to either the right or center ? 

Incidentally, how do I go about adding a button with a bitmap ?

As for the Toolbar title, do I use a UILabel for that ? 

Thanks.


Hi, 


For the alignment, you actually need to add extra special buttons that act as a flexible space, this is by design, as the Apple documentation describes how to achieve this.

Below is a sample that should show three buttons with flexible spaces, please note that these buttons are also counted in the collection and for the OnItemClick event:

var
  it: TTMSFMXNativeUIToolBarItem;
begin
  TMSFMXNativeUIToolBar1.BeginUpdate;
  it := TMSFMXNativeUIToolBar1.Items.Add;
  it.Text := 'Left Aligned';

  it := TMSFMXNativeUIToolBar1.Items.Add;
  it.Kind := ikSystem;
  it.SystemItem := siBarButtonSystemItemFlexibleSpace;

  it := TMSFMXNativeUIToolBar1.Items.Add;
  it.Text := 'Center Aligned';

  it := TMSFMXNativeUIToolBar1.Items.Add;
  it.Kind := ikSystem;
  it.SystemItem := siBarButtonSystemItemFlexibleSpace;

  it := TMSFMXNativeUIToolBar1.Items.Add;
  it.Text := 'Right Aligned';

  TMSFMXNativeUIToolBar1.EndUpdate;

To add an image, simply assign a value to the Bitmap property of an item, or load an image from a file with
it.Bitmap.LoadFromFile. Note that Apple will automatically convert the image to a white silhoutte to match the default style of the toolbar.

A Toolbar does not have a Title so you will need to add a TTMSFMXNativeUILabel to support a title.

Kind Regards, 
Pieter