Re: [Q] Activating an NSButtonCell
Re: [Q] Activating an NSButtonCell
- Subject: Re: [Q] Activating an NSButtonCell
- From: Brian Webster <email@hidden>
- Date: Thu, 12 Sep 2002 13:33:17 -0500
I'm pretty sure that Project Builder just uses plain NSButtons and
NSPopUpButtons for that task, with certain attributes set of course
(e.g. borderless). But PB has the advantage in that it controls that
header view that contains those buttons, so the buttons move
automatically with that view. In the case of an NSSplitView, there is
no subview for the divider, so you would have to manually move the
NSButton back and forth.
I know that Mail isn't considered the epitome of UI design, but the
paradigm that it uses lets you double click anywhere on the splitter to
open/close it. So that might be another option worth considering.
P.S. Does anyone know why my e-mails to cocoa-dev keep getting the
subject line erased? The message seemed to go to Mark correctly, but
it shows up with just "Re:" in the digest. :-/
On Thursday, September 12, 2002, at 12:34 PM, Mark de Jong wrote:
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
--
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.