diff --git a/power_console_common.h b/power_console_common.h index c4dcdce..58def32 100644 --- a/power_console_common.h +++ b/power_console_common.h @@ -46,6 +46,28 @@ class MouseWheelSlider : public Fl_Value_Slider } break; + case FL_KEYBOARD: + { + const auto key= Fl::event_key(); + if( key != FL_Down and key != FL_Up ) + { + return this->Fl_Value_Slider::handle( event ); + } + + const int polarity= Fl::event_key() == FL_Down ? +1 : -1; + const int newVal= value() + polarity * step(); + if( newVal >= maximum() + and newVal <= minimum() ) + { + value( newVal ); + } + + do_callback(); + + return 1; + } + break; + default: { return this->Fl_Value_Slider::handle( event );