• 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
Sizing NSTableView to data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sizing NSTableView to data


  • Subject: Sizing NSTableView to data
  • From: Maury Markowitz <email@hidden>
  • Date: Thu, 28 Jun 2012 16:42:08 -0400

I am working on the ODBCkit's Query Tool to make it work across a wide variety of data sources - so far all the major commercial DB's, Firebird, MySQL and even SQLite! Got an ODBC target and test DB you'd like to test? Throw it my way!

One problem that's come up in a couple of different places is that many SQL data types are fixed-width. I ask the recordset for the width, but it lies - it says 255 chars, but in fact there's only maybe 25 characters actually in the field. It is also surprisingly common to find numbers held in huge fixed-char fields. When I space out my TableView based on what the DB tells me, I end up with lots of whitespace.

I notice that *after* the DataSource is done setting up and the data is in the display, double-clicking the "divider line" in the header gives me perfect results. Is there a way to simulate that double-click in code? Ideally I'd like to find out what the width would be if I did the action, then adjust it for max/min sizes in the code.

Thanks!

p.s. First Cocoa project in years. Holy smokes XCode got a lot better since I last looked. That and this SSD rocks.
_______________________________________________

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: Sizing NSTableView to data
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Looking for better solution than this old hack
  • Next by Date: Re: NSSplitView question - how to implement my own "adjustViews" style method
  • Previous by thread: Re: Looking for better solution than this old hack
  • Next by thread: Re: Sizing NSTableView to data
  • Index(es):
    • Date
    • Thread