@@ -3,8 +3,8 @@ use gtk::prelude::*;
3
3
4
4
use gtk:: gdk:: Display ;
5
5
use gtk:: {
6
- Application , ApplicationWindow , Box as Box_ , Button , ComboBoxText , CssProvider , Entry ,
7
- Orientation , STYLE_PROVIDER_PRIORITY_APPLICATION ,
6
+ Application , ApplicationWindow , Box as Box_ , Button , CssProvider , DropDown , Entry , Orientation ,
7
+ STYLE_PROVIDER_PRIORITY_APPLICATION ,
8
8
} ;
9
9
10
10
fn main ( ) -> glib:: ExitCode {
@@ -42,19 +42,16 @@ fn build_ui(application: &Application) {
42
42
entry. add_css_class ( "entry1" ) ;
43
43
entry. set_text ( "Some text" ) ;
44
44
45
- let combo = ComboBoxText :: new ( ) ;
46
- combo. append_text ( "option 1" ) ;
47
- combo. append_text ( "option 2" ) ;
48
- combo. append_text ( "option 3" ) ;
49
- combo. set_active ( Some ( 0 ) ) ;
45
+ let model = gtk:: StringList :: new ( & [ "option 1" , "option 2" , "option 3" ] ) ;
46
+ let drop_down = DropDown :: new ( Some ( model) , gtk:: Expression :: NONE ) ;
50
47
51
48
vbox. append ( & button) ;
52
49
vbox. append ( & entry) ;
53
- vbox. append ( & combo ) ;
50
+ vbox. append ( & drop_down ) ;
54
51
// Then we add the container inside our window.
55
52
window. set_child ( Some ( & vbox) ) ;
56
53
57
54
application. connect_activate ( move |_| {
58
- window. show ( ) ;
55
+ window. present ( ) ;
59
56
} ) ;
60
57
}
0 commit comments