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

FxPlug Push and Help Selector needs "Button parameter ID" parameterization #438

Open
belisoful opened this issue Dec 20, 2024 · 0 comments

Comments

@belisoful
Copy link

Apple Feedback Assistant ID: MISSING!

Is your feature request related to a problem? Please describe.
The Push and Help Button selectors must be unique
It seems that the selector function should act without knowledge of the calling parameter.
But parameters are parameterized in an FxPlug framework and creating per parameter selectors is basically objective C Voodoo. I need to be able to pass one selector to all buttons and decide what do to in the selector based on which parameter was clicked.

This nuance makes the button and help button completely useless in a dynamic and/or parameterized context. 100% useless. It's not possible to construct new selectors, and have them stick around after restarting the app. These dynamic button selectors would need to be reconstructed dynamically on each load/deserialization. This is unacceptably complex.

Describe the solution you'd like

Pass the Parameter ID to the PushButton/Help Selector.

Instead of

- (void)myPushButtonSelector108;
- (void)myPushButtonSelector201;
...
[creationAPI_v5 addPushButtonWithName:@"param name" parameterID: 108 selector:@selector(myPushButtonSelector108) parameterFlags:flags];
[creationAPI_v5 addPushButtonWithName:@"param name" parameterID: 201 selector:@selector(myPushButtonSelector201) parameterFlags:flags];

It would look like this:

- (void)myPushButtonSelector: (UInt32)parameterID
{
    // parameterID 108 or 201, whichever is the id of the PushButton parameter that was clicked
   if (parameterID == 108) {
     //do 108 stuff
   } else {
     // do 201 stuff
   }
}
...
[creationAPI_v5 addPushButtonWithName:@"param name" parameterID: 108 selector:@selector(myPushButtonSelector:) parameterFlags:flags];
[creationAPI_v5 addPushButtonWithName:@"param name" parameterID: 201  selector:@selector(myPushButtonSelector:) parameterFlags:flags];

If my knowledge of objective c is swell enough, FxPlug can dynamically check the passed selector (within creation API v5, addPushButtonWithName and addHelpButtonWithName) and on click raise the selector with or without the parameter ID based on if the function accepts it. The API itself doesn't need to change, just expanded slightly without any change to existing operations. 100% backward compatible.

Describe alternatives you've considered
It's possible to dynamically insert a dynamically created methods to the main primary Effect object, for each button parameter so as to hack passing along the parameter Id.... but we are started to get into serious objective C voodoo.

I'm considering making dynamic selectors with parameter ID in the name, which is then decomposed by implementation via passed parameter, of course, this must be reconstructed each time the effect is deserialized. This requires getting the parameter types from the API, which is not (yet) part of the FxPlug API.

Forcing each parameter to have a different selector is an unreasonable requirement for FxPlug frameworks.

Additional context
As a framework developer, I consider this a bug because of just how ugly things are without it. But I get that this is an "enhancement" for most people. ✌️. So this is filed under "enhancement."

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

1 participant