This repository was archived by the owner on Jan 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcombo_box.cpp
More file actions
46 lines (39 loc) · 1.73 KB
/
Copy pathcombo_box.cpp
File metadata and controls
46 lines (39 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <xtd/xtd.forms>
using namespace xtd;
using namespace xtd::drawing;
using namespace xtd::forms;
namespace examples {
class form1 : public form {
public:
form1() {
controls().push_back_range({combo_box1, combo_box2, combo_box3});
text("Combo box example");
combo_box1.location({10, 10});
combo_box1.items().push_back_range({"Item1", "Item2", "Item3", "Item4", "Item5", "Item6", "Item7", "Item8", "Item9", "Item10"});
combo_box1.selected_index(0);
combo_box1.selected_index_changed += {*this, &form1::on_combo_box_click};
combo_box2.location({10, 50});
combo_box2.drop_down_style(combo_box_style::drop_down_list);
combo_box2.items().push_back_range({"Item1", "Item2", "Item3", "Item4", "Item5", "Item6", "Item7", "Item8", "Item9", "Item10"});
combo_box2.selected_index(0);
combo_box2.selected_index_changed += {*this, &form1::on_combo_box_click};
combo_box3.location({10, 90});
combo_box3.drop_down_style(combo_box_style::simple);
combo_box3.items().push_back_range({"Item1", "Item2", "Item3", "Item4", "Item5", "Item6", "Item7", "Item8", "Item9", "Item10"});
combo_box3.selected_index(0);
combo_box3.selected_index_changed += {*this, &form1::on_combo_box_click};
}
private:
void on_combo_box_click(control& sender, const xtd::event_args& e) {
combo_box1.selected_index(static_cast<combo_box&>(sender).selected_index());
combo_box2.selected_index(static_cast<combo_box&>(sender).selected_index());
combo_box3.selected_index(static_cast<combo_box&>(sender).selected_index());
}
combo_box combo_box1;
combo_box combo_box2;
combo_box combo_box3;
};
}
int main() {
application::run(examples::form1());
}