Re: notebook -> set_current_page has no effect at all



I presume that the code is complete and the Togglebutton is not visible; an empty Gtk::Notebook page will never show, and in this case it might be similar because the Button is not visible.

Try calling ::show_all_children() before you attempt to call ::set_current_page(), and if it still fails, make sure the button is visible with ::show_all() on the button.

2008/3/6, Yannick Barbeaux <ybarbeaux gmail com>:
I have a very basic window composed by a Notebook widget that has 3 tabs (3 togglebuttons)
I try to use the set_current_page function to activate the third tab but it has simply no effect at all. It just shows the window with the first tab activated.
Can anyone tell me what is wrong?? (I don't think it is a refresh problem as i could read in some related posts)

Thanks for your precious help!

Yannick

--------------------------------Sample of the code:--------------------------------------------------
(My window subclass Gtk::Window and contains members that are pointers to the notebook and the togglebuttons)

MyWindow::MyWindow()
 : r_notebook(new Gtk::Notebook()),
   r_toggleButton1(new Gtk::ToggleButton("--1--")),
   r_toggleButton2(new Gtk::ToggleButton("--2--")),
   r_toggleButton3(new Gtk::ToggleButton("--3--"))
{
  
   int index1 = r_notebook->append_page(*r_toggleButton1, "Toggle 1");
   int index2 = r_notebook->append_page(*r_toggleButton2, "Toggle 2");
   int index3 = r_notebook->append_page(*r_toggleButton3, "Toggle 3");

   add(*r_notebook);       // add Notebook to the top level window

   int index = r_notebook->page_num(*r_toggleButton3);   // get index of third tab
  
   if (index > 0)
   {
      r_notebook->set_current_page(index);      // pass here but does nothing at all
      std::cout<<"TAB " << index << " FOUND!!\n";
   }
  
   r_notebook->set_current_page(index3);   // another attempt ---> no effect at all neither!!
  
   show_all_children();
}



_______________________________________________
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]