Question

    refBuilder->get_widget("image1", image);

    if(image){
        pButton1->set_image(*image);
        //Glib::PropertyProxy<bool> prop;
        Gtk::Settings::property_gtk_button_images() = true;
    }

I know the last line isn't written properly, I don't know how to use PropertyProxy. I just want to set the property to true. that might not solve what I want to achieve, but it might be a step closer. The class reference didn't specify how to use them properly. Any suggestions?

Was it helpful?

Solution

I am not sure what are you looking for but if you want to put an image on a button, then here is the code. Basically you need to define an image and set that image to the given button.

Gtk::Button *btn=Gtk::manage(new Gtk::Button("DummyButton"));    
Gtk::Image  *ImageIcon=Gtk::manage(new Gtk::Image(Gtk::IconTheme::get_default()->load_icon("ButtonImage",128)));
btn->set_image(*ImageIcon);
btn->set_image_position(Gtk::POS_TOP);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top