• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: clicking in NSMatrix.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: clicking in NSMatrix.


  • Subject: Re: clicking in NSMatrix.
  • From: publiclook <email@hidden>
  • Date: Tue, 6 May 2003 18:17:58 -0400

Here is the implementation of a simple subclass of NSMatrix that provides the desired behavior of using a cell as the sender if the cell has its own target:

@implementation MyMatrix

- (BOOL)sendAction:(SEL)anAction to:(id)aTarget
{
id selectedCell = [self selectedCell];
BOOL actionWasSent = NO;

if(nil != selectedCell)
{
id target = [selectedCell target];

if(nil != target)
{
SEL action = [selectedCell action];

if(0 == action)
{
action = [self action];
}
if(0 != action)
{
[NSApp sendAction:action to:target from:selectedCell];
actionWasSent = YES;
}
}
}
if(!actionWasSent)
{
actionWasSent = [super sendAction:anAction to:aTarget];
}

return actionWasSent;
}

@end

Make IB aware of this class and then use IB's custom class inspector to change any matrix to a MyMatrix.

If anyone cares, I have a simple PB project and nib that shows action messages sent from menu items, stand alone buttons, and switch buttons cells in a matrix with the desired behavior that in all cases, the sender responds to the -title message. It could also use -tag or whatever.

On Tuesday, May 6, 2003, at 07:15 AM, Oscar Morales Vivs wrote:

On Tuesday, May 6, 2003, at 01:02 Europe/Madrid, publiclook wrote:

Each cell that has its own target sends itself as the sender of action messages. If your matrix has a target but the clicked contained cell does not, the matrix itself will be the sender. Each cell can also have its own action. All of this is or was documented by Apple.

Except that it doesn't :( At least not in my case. Maybe it's a bug? I did set all the cells' targets manually in IB and yet the sender is the matrix itself.
_______________________________________________
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: clicking in NSMatrix. (From: Oscar Morales Vivó <email@hidden>)

  • Prev by Date: Unix -> Cocoa question
  • Next by Date: Re: Unix -> Cocoa question
  • Previous by thread: Re: clicking in NSMatrix.
  • Next by thread: Relying on 10.2??
  • Index(es):
    • Date
    • Thread