Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request #1

Closed
DevulderJeanPaul opened this issue Jun 24, 2022 · 1 comment
Closed

request #1

DevulderJeanPaul opened this issue Jun 24, 2022 · 1 comment

Comments

@DevulderJeanPaul
Copy link

hi,
nice control
the problem is when you select a nsmenuitem
this function is called func splitMenuAction(_ sender: Any) but you can't know what is dsfcombobutton are the parent ?

suggestion
set func splitMenuAction(_ sender: Any,_ combo:Any) or use for each NSMenuItem use the property

representedObject for set the dsfcombobutton pointer.

the goal are when you select a item, update the title of dsfcombobutton

thanks,

@dagronf
Copy link
Owner

dagronf commented Jun 24, 2022

Hey mate,

I've been trying to keep this control as api-close to NSComboButton (in Ventura), hence some of the api decisions made here.

I'd rather the library not automatically set the representedObject for each menu item to the combobutton. Why?

  • It would have to parse each menu (and potentially submenu) for each menu item and update the representedObject, even if the user didn't care about it.
  • If the user has a custom representedObject for a menuItem, it would be changed when the menu was added without the caller knowing so.

Ultimately the behaviour of what the menu item does is up to you rather than the library, so I don't think forcing the combobutton to set the represented object for each menu item is the right idea (especially since other users might want to use the representedobject for other things and I don't want to stomp theirs).

the goal are when you select a item, update the title of dsfcombobutton

As you mentioned, you can manually add the DSFComboButton control to each menu item as the representedObject. This prevents the library from forcing a methodology on the caller.

Hope this clears things up. Thanks for the feedback!

@dagronf dagronf closed this as completed Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants