Re: best way to implement a clickable grid?
Re: best way to implement a clickable grid?
- Subject: Re: best way to implement a clickable grid?
- From: Uli Kusterer <email@hidden>
- Date: Tue, 15 Sep 2015 03:20:37 +0200
On 15 Sep 2015, at 02:35, Jens Alfke <email@hidden> wrote:
> I would probably just implement it as a custom NSView. Then it doesn’t even have to be represented in memory as a grid; you just remember the level for each x coord and fill in the appropriate squares when drawing.
>
>> Or is there a better way to handle click events on a simple NSView?
>
> Just override mouseDown:, mouseDragged:, mouseUp:. You’ll have to convert the event coords from window to view coords.
Oh, if you go the route of a custom view like Jens and I suggest, don't forget to implement Accessibility for it. You can probably just give a number indicating the level, but otherwise you might have to do whatever NSSlider does to expose itself to Accessibility. Or maybe you could just subclass NSSlider, replace all the tracking and drawing code, and that way get Accessibility for free.
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://stacksmith.org
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden