[gtkmm] Reload changed image on button



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

I've started using gtkmm four weeks ago and just ran in my first real problem. 
Maybe you can help:

I have a button. This button displays two changing images. Reloading the image 
via MyImage.set("differentfile.xpm") is too slow.

So I had the following idea


class KWindow: public Gtk::Window
{ public: 
    KWindow()
    { nums.add(*(new Gtk::Image("icon_mul.xpm")));
       store=new Gtk::Image("icon_mulused.xpm");
       add(nums);
       show_all(); }
    ~KWindow()
    { delete nums.get_child();
        delete store; } }
  protected:
    Gtk::Button nums;
    Gtk::Widget* store;
    void flip ()
    { Gtk::Widget* temp_image=store;
        store=nums.get_child();
        nums.remove();
        nums.add(*temp_image);
        show_all(); }
      return; } };

But that isn't just ugly, even worse, it doesn't work: The new images are 
loaded and dispappear again.

How would you solve this problem?

Any help appreciated,
 Kevin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFBUGQBcPYbVMv9nosRAoU/AKCRaf8iEuAAm+Rc9eQEX9bMAqBcZgCgj5aI
ouaftC4q1eyd+H8STPxTnG0=
=jGWQ
-----END PGP SIGNATURE-----



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