openframeworks / openframeworks/openFrameworks
ofxGui Slider Deferencing Should be Const
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
I am unable to return the deferenced value of an ofxGui slider from within a function marked as const. See the example code below. Please know that I am aware that I would be better off using an ofParameter instead of directly using ofxIntSlider. That said, dereferencing ofxGui sliders would still be better off as const friendly.
Example Header:
#include "ofxGui.h"
class Parameters {
ofxPanel gui_panel;
ofxIntSlider example_slider;
public:
Parameters();
int get_example_slider() const;
};
Example Cpp:
#include "Parameters.h"
Parameters::Parameters() {
gui_panel.setup();
gui_panel.add(example_slider.setup("Example Slider", 4, 0, 15));
}
int Parameters::get_avoidance_multiplier() const {
// ### THIS IS THE PROBLEM LINE:
return example_slider; // Works fine when function isn't const.
}
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 locating the ofxGui slider implementation and its dereference or conversion operator. Reproduce the example with get_example_slider() marked const, then inspect existing tests or usage for the expected const behavior. Done means a const Parameters accessor can return the slider value without removing const, with the relevant test or example passing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100