Re: interaction between widgets



 When you create your signal fucntion, you can pass a pointer to whatever
widget you want.
  Something like this:

 g_signal_connect(button_on_toolbar, button_callback_handler, "activate",
(gpointer) my_notebook);



  then one you callback handler, you have:

  button_callback_handler(GtkWidget* button_on_toolbar, gpointer data){
  /* the data passed in will be a pointer to "my_notebook" from above. */

  GtkNotebook*  book = (GtkNotebook*) data;

  Do whatever you want here wiht book.

}

  

  There is another way t pass the poiter -- you can connect an object to
another by using g_object_set_data(...) and then retrieve that pointer using
the g_object_get_data(...)
 Read the docs on this. (Which one is better ? it just depends on your taste.)

Hope this helps.
  








--- Axel <axel azerty netcourrier com> wrote:
> basically here is my problem
> I have a menubar created by : GtkMenubar* create_menubar()
> I have put in it the g_signal_connect for catch events like "activate",for
> each item of the menu. (maybe it is a wrong place)
> 
> Next to that I have a notebook, with a few page, and when I click in an item
> in the menu I d like to close the current page.
> 
> but I don' t know how to get the current pointer to GtkNotebook from
> create_menubar() or from my function close_page() (which is the CALLBACK
> designed to close the page)
> 
> I have probably made an error of "architectur" in my functions, so which is
> the best way to have interactions between items in the menubar and other
> widgets of the program ?
> In other words : activate item in the menu bar acts on the widgets in the
> program.
> 
> Axel
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com



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