• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Columns widths specified programmatically seem to be wider.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Columns widths specified programmatically seem to be wider.


  • Subject: Re: Columns widths specified programmatically seem to be wider.
  • From: Laurent Etiemble <email@hidden>
  • Date: Mon, 29 Jun 2009 17:52:41 +0200

Hello,

Take a look at "setIntercellSpacing:" in NSTableView Class Reference.
The default intercell spacing is (3.0, 2.0), so it may explains the
delta you see.

Regards, Laurent Etiemble.

Monobjc : A .NET/Objective-C Bridge
More info at http://www.monobjc.net/

2009/6/29 Nor <email@hidden>:
> Although total of the widths should be the same as the width in-between the
> left edge of the scrollview and the right edge minus the width of the
> vertical scroller,
> so although it should see all columns fully, the most right column can't see
> it whole content unless mouse-wheeling right.
>
>
> The following code is all I wrote. I put an NSTableView on a window which
> came in the Cocoa Application template, and an object which was called
> MyTableSizer.
>
> @interface MyTableSizer : NSObject {
>  IBOutlet NSTableView* _tableview;
> }
> @end
>
> @implementation MyTableSizer
> - (void) awakeFromNib
> {
>  float aScrollViewWidth = NSWidth([[_tableview enclosingScrollView]
> frame]);
>  float aTableViewWidth = aScrollViewWidth - [NSScroller scrollerWidth];
>
>  NSLog (@"ScrollView width : %f", aScrollViewWidth);
>  NSLog (@"TableView width  : %f", aTableViewWidth);
>
>  NSEnumerator* enm = [[NSArray arrayWithArray:[_tableview tableColumns]]
> objectEnumerator];
>  id col;
>  while (col = [enm nextObject])
> [_tableview removeTableColumn:col];
>
>
>  int counter = 5;
>  float quotient = aTableViewWidth / counter;
>  NSLog (@"Each Column's width: %f", quotient);
>  while (counter > 0)
>  {
> NSTableColumn* col = [[NSTableColumn alloc] initWithIdentifier:
>                     [NSString stringWithFormat:@"%d",counter]];
> [col setWidth:quotient];
> [_tableview addTableColumn:[col autorelease]];
> counter--;
>  }
> }
> @end
>
> That's all.
>
> The TableSizer is allocated and initialized in Nib file.
>
>
> 2009-06-29 18:06:47.302 TEST[2649:813] ScrollView width : 480.000000
> 2009-06-29 18:06:47.304 TEST[2649:813] TableView width  : 465.000000
> 2009-06-29 18:06:47.305 TEST[2649:813] Each Column's width: 93.000000
>
>
> The log seems to be correct, but actual tableview is actually wider.
>
> What do you think I'm missing?
>
> Any suggestions, advices, and workarounds would be very appreciated. I
> really need our help.
>
> Thank you,
> Norio
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Columns widths specified programmatically seem to be wider. (From: Nor <email@hidden>)

  • Prev by Date: Load File Faster.
  • Next by Date: Question on generating mouse events with modifier keys
  • Previous by thread: Columns widths specified programmatically seem to be wider.
  • Next by thread: Dock refuses dropped files
  • Index(es):
    • Date
    • Thread