#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/horizontal_layout_panel>
#include <xtd/forms/list_box>
namespace list_box_example {
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:
};
}
auto main() -> int {
application::run(list_box_example::form1 {});
}
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10