Re: NSButton and NSEvent
Re: NSButton and NSEvent
- Subject: Re: NSButton and NSEvent
- From: Jeremy Matthews <email@hidden>
- Date: Sat, 27 Feb 2010 21:27:53 -0500
Steven,
Thanks - the project needed a revisit...it grew from 2 checkboxes to nearly 40...time to re-examine a few things!
Thanks again for the tip....so deep into the forest I could not see the trees...
-j
On Feb 27, 2010, at 1:23 PM, Steven Degutis wrote:
> First of all, you may want to look into NSMatrix to accomplish this task instead of using individual NSButtons, both for performance reasons and (more importantly) to use the Cocoa API as it is intended (this is why NSMatrix was created, so it handles this relatively well).
>
> Secondly, if you use NSMatrix, or even NSTableView (which may be a better layout in this case), you can populate the items programmatically. Thus, you can have an array of model objects representing the data, with properties such as "userVisibleTitle" and "representedCommandLineOptionString" or something to that effect (and possibly an ID property too if need be, but probably not). Then you could supply these to the views rather easily, and readily fetch and display any property for a given object. Read more about this in the MVC section of Apple's docs.
>
> Also, regarding your feature to toggle the display between power users and "normal users", there's a few options. You could do this via tooltips, or you could have an option to choose to display the "normal" titles versus the command line options. But keep in mind, power users will probably prefer the command line anyway, usually. So I wouldn't put too much thought into this.
>
> -Steven
>
> On Sat, Feb 27, 2010 at 8:46 AM, Jeremy Matthews <email@hidden> wrote:
> So I have a application that I am getting ready to put some finishing touches on, but there are one or two things I'd like to do differently...er, better.
>
> It is a simple tool (Cocoa Desktop app) with a slew of checkboxes (around 40 in a separate window) that act as parameters on a command. While I show the user-friendly wording "yard work", behind the scenes I actually use parameters like "-lawngeneral" (if that checkbox is selected it does a check and provides the internal naming scheme when it builds the full command). Since the latter are part of the internal logic (and affect other systems), they cannot be changed at this time. But, I would like to be able to give those nsbuttons a second property that does not change depending on selection (so, alternateTitle would not work), just to make life easier when referencing said items. In NSMenu land, someone mentioned using setRepresentedItems, which worked great in my needs there...is there a similar feature for NSButton (specifically checkboxes)?
>
> Also, it would be nice if I could intercept an nsevent that changed their text from the user-friendly version to the internal logic titles - if only for some better understanding by power users (like, holding down the option key at any point in time). I've mucked around with some examples, but it seems like most depend on a a specific method and not silently observing in the background, like clicking on a button.
>
> How would you handle the first request, create a dictionary, or is there another method I missed?
> And the second, I'm not even sure..
>
> Any ideas?
>
> _______________________________________________
>
> 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
>
>
>
> --
> Steven Degutis
> http://www.thoughtfultree.com/
> http://www.degutis.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