Re: [Q] Activating an NSButtonCell
Re: [Q] Activating an NSButtonCell
- Subject: Re: [Q] Activating an NSButtonCell
- From: Mark de Jong <email@hidden>
- Date: Thu, 12 Sep 2002 10:34:57 -0700
Thanks, Brian, for the feedback.
Actually, I was trying to use an NSButton initially, but I couldn't get
it to display at all. That's why I switched to an NSButtonCell.
I'd really like to do this the "right" way. So, how do you think PB
does it's buttons that appear at the top of the editor pane (the left
and right arrows for files, check syntax checkmark button, split window
buttons, etc)? It nearly looks like a mini-toolbar. Is that what they
do?
Thanks,
-- Mark
On Thursday, September 12, 2002, at 07:00 AM, Brian Webster wrote:
On Thursday, September 12, 2002, at 12:00 AM,
email@hidden wrote:
I've overridden NSSplitView because I'd like to add an NSButtonCell in
the divider column that allows the split view to be toggle between
being open or closed.
<snip>
The "arrowButton" appears exactly where I would like it to. However,
it
does not respond to mouseclicks at all.
I think I need to add arrowButton to the responder chain. If so, how
do
I do this?
Alternatively, is there a better way to go about doing this?
A cell is not part of the view hierarchy and must be given events by
some member of the view hierarchy, usually an NSControl of some kind.
There are two ways you could go about this:
1. Use an NSButton instead of an NSButtonCell. This would mean that
you would have to maintain the button's proper position in the split
view when the slider moves, but it would give you automatic support
for clicks that occur within the button's bounds.
2. Route the mouse clicks manually to the NSButtonCell's
trackMouse:inRect:ofView:untilMouseUp: method (defined in NSCell).
You would need to detect when click fell within the cell's bounds and
basically do what NSButton does to feed the events to the cell for
tracking.
--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: | |
| >Re: (From: Brian Webster <email@hidden>) |