Template Class NumericTypedInput#

Inheritance Relationships#

Base Type#

Class Documentation#

template<NumericInput InputType>
class NumericTypedInput : public Karana::WebUI::TypedInput<InputType>#

Specialization of TypedInput to numeric types such as int and float. Provides additional setters.

Template Parameters:

InputType – Numeric type to store in the widget

Public Functions

inline NumericTypedInput(Router &router, std::string_view text, std::string_view tooltip, std::function<void(InputType)> on_change = {}, int64_t debounce_ms = 500, const Karana::Core::ks_ptr<State> &value_state = nullptr)#

Construct a new Numeric TypedInput object.

Parameters:
  • router – The connection router to use

  • text – Legend text displayed on the widget

  • tooltip – The tooltip to show on hover

  • on_change – Callback for when the widget state is modified

  • debounce_ms – Delay in milliseconds before submitting numeric edits

  • value_state – State for synchronizing the slider’s value

void setMin(InputType min)#

Set the min value of the slider.

Parameters:

min – The lower bound on possible values

void setMax(InputType max)#

Set the max value of the slider.

Parameters:

max – The upper bound on possible values

void setStep(InputType step)#

Set the step size of the slider.

Parameters:

step – The step size of values on the slider

void setDebounceMs(int64_t debounce_ms)#

Set the delay before submitting numeric input changes. A value of zero means changes will be submitted immediately.

Parameters:

debounce_ms – Nonnegative delay in milliseconds

Protected Functions

virtual void _onConnect(int client_id) override#

First setup on initial connection.

Parameters:

client_id – The ID of the client connecting.

Protected Attributes

int64_t _debounce_ms = 500#

Delay sent to newly connected clients.

InputType _min = 0#

Minimum legal value.

InputType _max = 100#

Maximum legal value.

InputType _step = 1#

Step size for any UI elements; note that a value does not need to be a multiple of steps to be legal.