Re: Disable popup button cell in table view
Re: Disable popup button cell in table view
- Subject: Re: Disable popup button cell in table view
- From: Greg Hoover <email@hidden>
- Date: Tue, 26 Jun 2007 02:02:17 -0700
I ended up subclassing NSPopUpButtonCell with a new state attribute
that's used to decide whether to:
a) draw the menu via the super class implementation in
NSPopUpButtonCell or
b) draw the selected item title as a string according to the cell's
font attribute
I also had to override the trackMouse method the same way.
Took less work that I thought. Thanks for your reply.
Greg
On Jun 26, 2007, at 1:55 AM, Stephane Sudre wrote:
Yes, the text is drawn in gray. But that's what users expect when a
popup button is disabled.
If you want to have the text drawn as black, a better solution
could be to switch from a NSPopupButtonCell to a NSTextFieldCell
for this case. This way the text is drawn black and the user can
understand that this item is not editable.
There's a method in the NSTableView delegate or table source
section that lets you specify the class of cell to use for a
specific cell of the table.
On 26 juin 07, at 0:58, Greg Hoover wrote:
That works, but grey's out the text. I'm figuring that this will
require subclassing a popupbutton cell.
Thanks.
Greg
On Jun 25, 2007, at 3:52 PM, Stephane Sudre wrote:
On Jun 26, 2007, at 12:11 AM, Greg Hoover wrote:
I'd like to make a table view be optionally editable based on
some user preference. The delegate method shouldEditTableColumn:
works well for text cells, but popup button cells don't seem to
respect this setting.
Is it possible to disable a popup button cell in a table view
(ie. prevent it from showing the menu when clicked on)? I'm
hoping there's a method simpler than swapping out the cell class.
In - (void)tableView:(NSTableView *)tableView willDisplayCell:(id)
cell forTableColumn:(NSTableColumn *)tableColumn row:(int) rowIndex;
you just disable the cell if needed.
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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