Re: When the sender is an NSMatrix...
Re: When the sender is an NSMatrix...
- Subject: Re: When the sender is an NSMatrix...
- From: j o a r <email@hidden>
- Date: Wed, 9 Jul 2003 09:56:41 +0200
Don't be so sure that the action will be triggered by a mouse event!
How would your code deal with an action triggered by a someone using
full keyboard access to change the selection in a matrix?
Don't fight the frameworks, use them like they were intended! The best
way to do that is to ask the mailing list archives for advice...
j o a r
On Tuesday, Jul 8, 2003, at 02:24 Europe/Stockholm, David Vernon wrote:
I've had the same problem, I can't get the cell to be the sender. Try
something like this (all of this is of course reproducable in Obj. C):
public void ToolPaletteAction (Object sender) {
NSMatrix tmp = (NSMatrix)sender;
NSPoint locationClicked = NSEvent.mouseLocation();
locationClicked =
(window().convertScreenToBase(locationClicked));
SetTool (tmp.cellAtLocation(tmp.rowForPoint(locationClicked),
tmp.columnForPoint(locationClicked)).tag());
}
Cells are detected correctly using this method, but tags are sort of
reordered because of the origin location in the matrix's window. I'm
sure you could remedy this but it hasn't bugged me enough to do this
yet.
_______________________________________________
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.