Replies: 2 comments
-
bool MyCustomComponent::OnEvent(Event event) final {
if (!event.is_mouse()) {
// [...]
return false;
}
if (box_.Contain(event.mouse().x, event.mouse().y)) {
// [...]
return true;
}
return false; Element MyCustomComponent::Render() override {
return slider->Render() | reflect(box_);
}
|
Beta Was this translation helpful? Give feedback.
-
Thanks. Ultimately just giving the Slider class a corresponding SliderOptions class with an .on_change member would be awesome to round out the functionality of this component. |
Beta Was this translation helpful? Give feedback.
-
Two part question related to Sliders:
Is there any way to change the min, max, and increment on a Slider after its original creation? Seems like these arguments should be passed by-pointer instead of by-value, so that later program flow can update these like it can for the value argument.
After decorating a Slider with a CatchEvent(), some events (e.g. ArrowLeft and ArrowRight) are caught only when the focus is on that Slider element, but other events (e.g. mouse().button ) are caught regardless of where the mouse was clicked in the terminal window. Is it possible to catch mouse button presses ONLY when the button is pressed in the Slider area and not elsewhere in the terminal? If necessary, what is the recommended logic to use for querying the coordinates of the Slider and then sorting clicks based on mouse cursor position?
Beta Was this translation helpful? Give feedback.
All reactions