The following code example demonstrate the use of list_box control.
#include <xtd/xtd>
namespace examples {
class form1 : public form {
public:
form1() {
text("List box example");
client_size({360, 240});
layout_panel.parent(*this);
layout_panel.controls().push_back_range({list_box_left, list_box_right});
layout_panel.control_layout_style(list_box_left, {size_type::auto_size, true});
layout_panel.control_layout_style(list_box_right, {size_type::auto_size, true});
layout_panel.dock(dock_style::fill);
list_box_left.double_click += [&] {
if (list_box_left.selected_index() != list_box_left.npos) {
list_box_right.items().push_back(list_box_left.selected_item());
list_box_right.selected_index(0);
list_box_left.items().erase_at(list_box_left.selected_index());
}
};
list_box_right.sorted(true);
list_box_right.double_click += [&] {
if (list_box_right.selected_index() != list_box_right.npos) {
list_box_left.items().push_back(list_box_right.selected_item());
list_box_left.selected_index(0);
list_box_right.items().erase_at(list_box_right.selected_index());
}
};
list_box_left.items().push_back_range({"draw", "cut", "paste", "delete", "open", "close", "remove", "edit", "find", "increment", "decrement", "write", "read", "post", "build", "make", "release", "create", "choose", "erase"});
list_box_left.selected_index(0);
}
private:
horizontal_layout_panel layout_panel;
list_box list_box_left;
list_box list_box_right;
};
}
int main() {
application::run(examples::form1());
}
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition: bitmap.h:11
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17