openframeworks / openframeworks/openFrameworks
Document addListener callback types and add generic callback
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
For instance, calling ofxGui addListener method with the incorrect callback function type results in a cryptic error message with VS, complains about pass by reference vs by value parameter in the template for ofEvent, but what it is really complaining about is that the callback function supplied doesn't accept expected parameters (I'm guessing some issue with template abstraction?). It took me a while to figure out that callbacks for a type must accept a reference to a variable of that type, but then I saw this post:
http://forum.openframeworks.cc/t/dynamic-buttons/13406
Which implies that you can supply other types of callback functions that also receive context regarding the source of the callback. If this is the case, couldn't it also be possible to provide a callback with no parameters at all so that for instance ANY ofxGui control addListener call could call back to the same function that expects no parameters, like an ofxButton does? Like if you just want to know if ANY value changed regardless of the type or new value?
Is this more about ofParameter?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the ofxGui addListener, ofEvent, and ofParameter APIs referenced in the issue, then review the linked callback examples. Clarify the supported callback signatures and whether a parameter-independent callback is intended; done means the API behavior and callback types are documented and the requested generic behavior has a decided implementation scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100