Re: Putting a image on the Gtk::Button..?



Hi,

i have created a very small program to put a simple image on the button .
 the method show_all does not work i mean a cant see the image but the
explicitly calling the show method works. My program is given below..

#ifndef UNITTEST_H_INCLUDED
#define UNITTEST_H_INCLUDED
#include <gtkmm.h>
class Mywindow : public Gtk::Window
{
    public:
    Mywindow();
    virtual ~Mywindow();
    private:
    Gtk::VBox m_main_vbox;
    Gtk::Button m_close_button;
    Gtk::Image m_button_image;

};

#endif // UNITTEST_H_INCLUDED

#include "Unittest.h"
#include <iostream>

Mywindow::Mywindow():m_main_vbox(false,10),m_close_button("close
me"),m_button_image("gtk-paste.png")
{
    m_close_button.set_image(m_button_image);
    m_main_vbox.pack_start(m_close_button);
    add(m_main_vbox);

    m_close_button.show_all();  // Does not work i cant see the image
    show_all_children();
   // without explicitly calling the show method i cant see the image
     m_button_image.show();  // works..
}
Mywindow::~Mywindow()
{
}

#include "Unittest.h"
#include <iostream>
int main(int argc, char *argv[])
{
    Gtk::Main kit(argc,argv);
    Mywindow mwindow;
    kit.run(mwindow);
}

     i am very new to programming so i dont know how to write a test
case using tools such as  Boost.test ( i am looking into it). please
check this and if i made any mistake please tell me.



with regards........


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]