From b88e642f4a9a9b6ed3d953d1eed56c69d3bcab12 Mon Sep 17 00:00:00 2001 From: Luca Lombardo Date: Mon, 4 Mar 2024 23:36:18 +0100 Subject: [PATCH] set default values for combo box and switch --- src/main.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 76410dd..9ac687d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,4 @@ +use gtk::glib::property::PropertyGet; use gtk::{prelude::*, Align, Box, Button, FileChooserAction, FileChooserDialog, Label, Orientation, ResponseType, Stack, StackSidebar}; use gtk::{glib, Application, ApplicationWindow}; @@ -73,19 +74,26 @@ fn print_utils(window: &ApplicationWindow) -> Box { // Add a combo box let combo_box = gtk::ComboBoxText::new(); // add 3 items to the combo box - combo_box.append_text("Aula 3"); combo_box.append_text("Aula 4"); + combo_box.append_text("Aula 3"); combo_box.append_text("Corridoio Piano Terra"); + combo_box.set_active(Some(0)); // aula 4 di default + + + let seleziona_stampante = Label::new(Some("Seleziona la stampante:")); let box2 = Box::new(Orientation::Horizontal, 10); + // put the combo box to the right of the label box2.append(&seleziona_stampante); box2.append(&combo_box); let fronte_retro = gtk::Switch::new(); let fronte_retro_label = Label::new(Some("\tFronte retro")); // dovrei mettere Aling::End, ma non funziona + fronte_retro.set_active(true); + box2.append(&fronte_retro_label); box2.append(&fronte_retro);