• 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
Columns widths specified programmatically seem to be wider.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Columns widths specified programmatically seem to be wider.


  • Subject: Columns widths specified programmatically seem to be wider.
  • From: Nor <email@hidden>
  • Date: Tue, 30 Jun 2009 00:18:03 +0900

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

  • Follow-Ups:
    • Re: Columns widths specified programmatically seem to be wider.
      • From: Laurent Etiemble <email@hidden>
  • Prev by Date: Disabling buttons in NSSavePanel
  • Next by Date: Re: Objective C Compiler Settings
  • Previous by thread: Columns widths specified programmatically seem to be wider.
  • Next by thread: Re: Columns widths specified programmatically seem to be wider.
  • Index(es):
    • Date
    • Thread