Class Dropdown#

Inheritance Relationships#

Base Type#

Class Documentation#

class Dropdown : public Karana::WebUI::Widget#

Widget displaying a Dropdown menu via an HTML select.

Uses a single State object to store the index selected.

Public Functions

Dropdown(Router &router, std::string_view text, const std::vector<std::string> &choices, std::function<void(size_t)> on_change = {}, const Karana::Core::ks_ptr<State> &select_state = nullptr)#

Dropdown constructor.

Parameters:
  • router – The connection router to use

  • text – The label displayed for the Dropdown

  • choices – Options for the Dropdown (e.g. min, max, step)

  • on_change – Called when the Dropdown is modified

  • select_stateState for synchronizing the Dropdown’s value

virtual ~Dropdown()#

Dropdown destructor.

void setIndex(size_t index)#

Set the current index of the dropdown.

Parameters:

index – The index of the current dropdown item