Re: NSMatrix actions
Re: NSMatrix actions
- Subject: Re: NSMatrix actions
- From: "Erik M. Buck" <email@hidden>
- Date: Thu, 11 Oct 2001 10:51:52 -0500
If you are not going to even read or try what I write then I won't bother
any more.
In InterfaceBuilder
1) Select the classes tab in the window that has the name of your nib
2) use the tree view to select NSObject
NSObject->NSResponder-.NSView->NSControl->NSMatrix
3) Use the "Classes" menu to subclass NSMatrix (this actually just tell
IB about a sub-class, you could also just parse the class interface for the
subclass of NSMatrix that you have already created)
4) Place a button cell in your window.
5) Drag the button's knobbie while holding OPTION in order to create a
matrix of buttons
6) With the matrix selected, use the "Custom Class" mode if the info
panel to change the selected matrix to an instance of your subclass of
NSMatrix
7) Resize the matrix while holding OPTION so that there is only one
instance of button cell in the matrix
8) Set the target and action of the instance of your subclass of
NSMatrix using IB
In your program, tell the instance of your subclass of NSMatrix what
cell class to use or set its prototype. Remove the unwanted NSButtonCell
from your matrix. Tell the instance of your subclass of NSMatrix how many
rows and columns it has. It will create cells with the specified class or
copy the prototype cell as appropriate.
- OR -
You can do it all programmatically:
I told you how to set a NSMatrix instance's action right after the text that
you quoted:
<QUOTE>
In NSControl
http://developer.apple.com/techpubs/macosx/Cocoa/Reference/ApplicationKit/Ob
jC_classic/Classes/NSControl.html#//apple_ref/occ/instm/NSControl/
setAction:
- (void)setAction:(SEL)aSelector
Sets the receiver's action method to aSelector. If aSelector is nil, then no
action messages will be sent from the receiver.
See Also: - action - setTarget: - target
setTarget:
- (void)setTarget:(id)anObject
Sets the target object for the action message of the receiver's cell;
NSCell's setTarget: is used instead of any subclass override of this method.
If anObject is nil and the control sends an action message, the application
looks for an object that can respond to the message by following the
responder chain (see description of the NSActionCell class for details).
See Also: - action - setAction: - target - setTarget: (NSCell)
<END QUOTE>
See more comments interleaved with your questions below:
----- Original Message -----