Skip to content

ADropdownList#

A button with dropdown list.

Header:#include <AUI/View/ADropdownList.h>
CMake:aui_link(my_target PUBLIC aui::views)

Examples#

examples/7guis/flight_booker/src/main.cpp

7GUIs Flight Booker - Flight Booker.

    // Set contents
    window->setContents(Centered {
      Vertical {
        _new<ADropdownList>(AListModel<AString>::make({ "one-way flight", "return flight" })) AUI_LET {
                AObject::connect(AUI_REACT(state->isReturnFlight ? 1 : 0), it->selectionId());
                AObject::connect(it->selectionId().changed, AObject::GENERIC_OBSERVER, [=](int newSelection) {
                    state->isReturnFlight = newSelection == 1;
                });
            },

Public Methods#

selectionId#


auto ADropdownList::selectionId()

Selected id property.

Examples:

examples/7guis/flight_booker/src/main.cpp

7GUIs Flight Booker - Flight Booker.

    // Set contents
    window->setContents(Centered {
      Vertical {
        _new<ADropdownList>(AListModel<AString>::make({ "one-way flight", "return flight" })) AUI_LET {
                AObject::connect(AUI_REACT(state->isReturnFlight ? 1 : 0), it->selectionId());
                AObject::connect(it->selectionId().changed, AObject::GENERIC_OBSERVER, [=](int newSelection) {
                    state->isReturnFlight = newSelection == 1;
                });
            },
        dateTextField(AUI_PTR_ALIAS(state, departureDate)),