private void createButton() { Gtk.VBox vbox = new Gtk.VBox(); Gtk.Image image = new Gtk.Image(); addUserPhotoIfExists(image); image.HeightRequest = 150; image.Visible = true; Gtk.Label label_select = new Gtk.Label("Select !"); label_select.Visible = false; //hide this to the user until button is clicked first time Gtk.Label label_id = new Gtk.Label(personID.ToString()); label_id.Visible = false; //hide this to the user Gtk.Viewport viewport = new Gtk.Viewport(); UtilGtk.ViewportColorDefault(viewport); Gtk.Label label_name = new Gtk.Label(personName); label_name.Visible = true; label_name.Show(); viewport.Add(label_name); viewport.Show(); vbox.PackStart(image); //0 vbox.PackStart(label_id); //1 vbox.PackEnd(viewport, false, false, 1); //2 (contains label_name) vbox.Show(); button = new Button(vbox); button.WidthRequest = 150; button.HeightRequest = 170; }
//public methods ------------------------------- public void Select(bool select) { Array box_elements = getButtonBoxElements(button); //image Gtk.Image image = (Gtk.Image)box_elements.GetValue(0); //the image Gtk.Viewport viewport = (Gtk.Viewport)box_elements.GetValue(2); //the name if (select) { UtilGtk.ViewportColor(viewport, UtilGtk.YELLOW); } else { UtilGtk.ViewportColorDefault(viewport); } Selected = select; }