Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

Tableview alignment not working

 Post Reply Post Reply
Author
Shelton Brent View Drop Down
New Member
New Member
Avatar

Joined: 29 Mar 2013
Posts: 31
Post Options Post Options   Quote Shelton Brent Quote  Post ReplyReply Direct Link To This Post Topic: Tableview alignment not working
    Posted: 21 Oct 2013 at 12:54pm
In the Tableview I cannot get the alignment to work

  with TableView1.Columns.Add do begin
    Header := 'Date';
    ReadOnly := True;
    Alignment := TTextAlign.taCenter;
  end;
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3187
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 22 Oct 2013 at 2:37am
Hi, 

The Alignment property is used for the column values, not for the column header. You can access the native column with the following code, and set the alignment there:

  TNSTableHeaderCell.Wrap(TMSFMXNativeNSTableView1.Columns[0].GetTableColumn.headerCell).setAlignment(2);

Values for alignment are:

NSLeftTextAlignment      = 0
NSRightTextAlignment     = 1
NSCenterTextAlignment    = 2
NSJustifiedTextAlignment = 3
NSNaturalTextAlignment   = 4

Kind Regards, 
Pieter

Back to Top
Shelton Brent View Drop Down
New Member
New Member
Avatar

Joined: 29 Mar 2013
Posts: 31
Post Options Post Options   Quote Shelton Brent Quote  Post ReplyReply Direct Link To This Post Posted: 22 Oct 2013 at 8:44am
Which unit do I need to include to use TNSTableHeaderCell?
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3187
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 22 Oct 2013 at 8:48am
The unit iOSApi.UIKit should be the unit which declares the NSTableHeaderCell
Back to Top
Shelton Brent View Drop Down
New Member
New Member
Avatar

Joined: 29 Mar 2013
Posts: 31
Post Options Post Options   Quote Shelton Brent Quote  Post ReplyReply Direct Link To This Post Posted: 22 Oct 2013 at 9:17am
This is a Mac app not an iOS app.  Delphi doesn't recognize that unit.
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3187
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 23 Oct 2013 at 7:19am
the MacApi.AppKit unit.
Back to Top
Shelton Brent View Drop Down
New Member
New Member
Avatar

Joined: 29 Mar 2013
Posts: 31
Post Options Post Options   Quote Shelton Brent Quote  Post ReplyReply Direct Link To This Post Posted: 23 Oct 2013 at 1:34pm
It got this to work in the form create but I had to put it after the TableView1.EndUpdate or the program crashes:
TNSTableHeaderCell.Wrap(TMSFMXNativeNSTableView1.Columns[0].GetTableColumn.headerCell).setAlignment(2);

I also have to put the code in the GetAlignment event.

I cannot get the regular cells to align though.  How should I do that?
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3187
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 24 Oct 2013 at 2:33am
Normally this should be done with the Alignment property for each column as shown in your first post.
Are you experiencing difficulties with this?

Kind Regards, 
Pieter
Back to Top
Brent Shelton View Drop Down
New Member
New Member
Avatar

Joined: 24 Feb 2015
Posts: 30
Post Options Post Options   Quote Brent Shelton Quote  Post ReplyReply Direct Link To This Post Posted: 04 Aug 2016 at 10:44pm
I figured I'd use this old post.  How can I set the alignment of a checkbox in a cell?  The checkbox shows up when I use Values.Add.BooleanValue := True;

Thanks!
Brent
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3187
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 05 Aug 2016 at 9:04am
Hi, 

We have investigated this here and have applied a content alignment property at column level and the appriopriate event for further customization. The next version will allow you to set checkboxes centered with the columns CellContentAlignment property.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down