Temporary text display over NSTableView (was NSTextField over NSImageView?)
Temporary text display over NSTableView (was NSTextField over NSImageView?)
- Subject: Temporary text display over NSTableView (was NSTextField over NSImageView?)
- From: James Bucanek <email@hidden>
- Date: Sun, 23 Apr 2006 08:20:32 -0700
Greetings,
All of this discussion about drawing order and using NSViews to draw over other NSViews brings me to a (hopefully) simple feature that I've been meaning to add to my application for months.
When a user opens a new document window they get an empty NSTableView -- this is not very informative. I'd like to superimpose some subtle text (light grey or semi-transparent) over the center of the table to the effect of "To add items to the table, drag and drop them here." This text would go away as soon as the table was no longer empty.
What would be the sane+Cocoa way of accomplishing this?
- I know that I could simply override the NSTableView's drawing routine and draw my text directly into the view after the table is finished drawing. I've been putting this off because it just seems like a lot of work (get a font, measure it, calculate a centering rectangle, ...).
- Using NSTextField would make less work for me because it would handle all of the centering, clipping, wrapping, etc. of the text (and I could localize the message in the NIB). But where do I stick it in the NSView hierarchy and how to I keep it centered over the table? From the earlier thread, it appears that just cramming it into the same NSView that the NSTableView is in is a bad idea. On the other hand, making an NSTextField a subview of an NSTableView just seems bizarre and I'm afraid of messing up the NSTableView's subview(s).
Any suggestions from the NSView mavens out there?
--
James Bucanek
_______________________________________________
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