On Wed, March 10, 2010 01:36, James Parkinson wrote:
>
> How do you signal another Widget, such as changing a NoteBook Tab when you
> select a menu item, especially when the widgets are defined in a glade xml
> file ?
>
> In the example code, when you click the menu item, it calls
> on_menu_change_tab() as the action for that menu item.
> How can this do the equivalent of  nbMain.set_current_page(4)  without
> causing a Segment fault on windoze ?
> [...]
>       builder.connect_signals (null)
> [...]
>   [CCode (cname="G_MODULE_EXPORT on_menu_change_tab")]
>   def on_menu_change_tab ()

There are two problems with your handler:

1) It needs to have 'instance_pos = -1' added to the CCode clause, so it
   will look like:

   [CCode (name="G_MODULE_EXPORT on_menu_change_tab", instance_pos = -1)]
   def on_menu_change_tab ()

   That will change the signature of the method to what Gtk.Builer expects.

2) You need to pass 'this' as argument to builder.connect_signals, so it
   can get passed to the handler.

3) Than just call nbMain.set_current_page(4) in the handler.

-- 
                                        - Jan Hudec <[email protected]>

_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to