Re: [gtkmm] Gtk::Notebook::insert_page



On Tue, 6 May 2003 13:34:23 +0200
Markus Gerwinski <markus gerwinski de> wrote:

> Hi folks,
> 
> I tried to use the Gtk::Notebook::insert_page method with a self-defined tab
> label:
> 
>   Gtk::Notebook::insert_page ( Widget &child, Widget &tab_label, int position );
> 
> For tab_label, I created a Gtk::HBox containing an icon and a label. But it
> didn't work: In the running program, the tab label was empty.
> 

I assume you use gtkmm2. I do something like this in my program GSpeakers:

  m_main_notebook.append_page(crossover_paned, *manage(new TabWidget("filter_small.png", _("Crossover") ) ) );

class TabWidget : public Gtk::HBox
{
public:
  TabWidget(string filename, string text);
private:
  Gtk::Image *image;
};

TabWidget::TabWidget(string filename, string text) : Gtk::HBox()
{
  try {
    Glib::RefPtr<Gdk::Pixbuf> icon = Gdk::Pixbuf::create_from_file(string(GSPEAKERS_PREFIX) + "/share/pixmaps/" + filename);
    image = manage(new Gtk::Image(icon));
    pack_start(*image);
  } catch (Gdk::PixbufError e) {
    cout << e.code() << endl;
  }  catch (Glib::FileError fe) {
    cout << fe.code() << endl;
  }
  
  pack_start(*(manage(new Gtk::Label(text))));
  show_all();

}

That works for me.

---
Daniel Sundberg
http://sumpan.com

> Can someone tell me what I'm doing wrong?
> 
> Thanks in advance,
> 
>   Markus
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
> 



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