NSTableView and automatically hiding scrollers
NSTableView and automatically hiding scrollers
- Subject: NSTableView and automatically hiding scrollers
- From: email@hidden
- Date: Thu, 23 Dec 2004 23:34:38 -0700
- Z-usanet-msgid: XID435iLXgIM0291X38
An NSTableView with scrollers set to hide automatically doesn't seem to behave
properly. At
times a horizontal or vertical scroller appears, even when not necessary. At
other times, a
space appears for the scroller (the "knob slot"), but no scroll knob or button
is present. As well,
the scroll knob size is at times incorrect.
It's easy to replicate this behaviour. Create a project with one window. In
the window, place a
table view, and size it to fill the window. Leave all the options as they
are, *except*
"Automatically Hide Scrollers" - that should be checked. Finally, set the
table view so that it
resizes with the window.
For the data source, set numberOfRowsInTableView: to return 10 (this is
arbitrary; other values
have the same behaviour), and tableView:objectValueForTableColumn:row: to
return the current
date. (If this sounds familiar, it's basically the example in the Learning
Cocoa book, pages 153
to 158, but even simpler).
(1) Now, start the program. By default, it should be big enough to display
all the rows, but if it
isn't, size it so that it's big enough to do so. Then, very slowly, shrink
the window vertically.
When the window becomes one pixel too small to hold the entire table, you
would expect a
vertical scroller, and only a vertical scroller, to appear. Instead,
however:
- a horizontal scroller appears
- a vertical scroller appears (as it should), but the scroll knob is too
small
Now, shrink the window vertically one more pixel. More strangeness:
- the horizontal scroller disappears
- the vertical scroller is the correct size
In other words, things are now as they should be. Further shrinking of the
window is handled
correctly.
(2) Now resize the window so that it's big enough to contain the entire table
again. The
scrollers disappear, as they should. Once more, shrink the window vertically,
very slowly, until,
as before, the horizontal and vertical scrollers appear. This time, instead
of shrinking the
window again, expand it one pixel. You would expect the scrollers to just
disappear. But no,
more strangeness:
- the scroll knobs and buttons disappear on both scrollers, but not the knob
slots
Note that there's a row behind the horizontal knob slot, and Cocoa knows about
it. If you select
one of the rows and use the arrow key to move down, you can select the bottom
row. However,
a bit more strangeness:
- when the bottom row is selected, the entire table is updated (you can see
the times change
for all the rows). Normally only the selected row is updated.
Further expanding the table will eventually result in the horizontal and
vertical knob slots
disappearing entirely (and simultaneously).
(3) This behaviour is nearly the same in the horizontal direction, but there
are some differences:
- shrinking it horizontally to the point where a horizontal scroller is just
needed (you'll have to
adjust column sizes to get this to happen) results in both scrollers
erroneously appearing, and
the horizontal scroll knob is the wrong size. However, unlike the vertical
case, expanding it
doesn't result in the disappearance of just the knobs and buttons - the
scrollers disappear
entirely, as they should.
- its notion of "a horizontal scroller is needed" doesn't depend on the size
of the columns, nor
the length of the text in them. In fact, I'm not quite sure what it depends
on. Presumably
there's a simple answer for this one; I haven't looked into it. In any case,
it certainly seems
non-intuitive.
So, any ideas? This sure seems like a bug to me, but I couldn't find any
references to it. By the
way, I'm on OS X 10.3.7, Xcode 1.5, and IB 2.4.2.
Brian Schack mailto: bschack-
email@hidden
19 Hsu Chang Street 2F phone: 2381 4727
Taipei 100 fax: 2381 2145
TAIWAN
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden