Re: [Vala] [Genie] emulate a mouse click to trigger widget changes
btw, when you say a crash on windows, you mean you didn't test somewhere else, not that it works, right? To confirm, I am running it on Windows and the attempt to trigger a change of the NoteBook page crashes, and haven't tried it on Linux, so I don't know if it works on Linux. So far all suggestions haven't worked, but thanks for your suggestions. _ Get personal with Windows. Download a free gift for your PC. http://experience.windows.com___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] [Genie] emulate a mouse click to trigger widget changes
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. Thanks, but it didn't solve the problem. I get 4 [main] MyApp 2944 _cygtls::handle_exceptions: Exception: STATUS_ACCESS_VIOLATION 475 [main] MyApp 2944 open_stackdumpfile: Dumping stack trace to MyApp.exe.stackdump dumped out to the console then the application exits. _ Browse profiles for FREE! Meet local singles online. http://clk.atdmt.com/NMN/go/150855801/direct/01/___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] [Genie] emulate a mouse click to trigger widget changes
Hi, 2010/3/11 James Parkinson jlp...@hotmail.com: 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. This is the good way to do it, but if the method doesn't take any parameter, it won't change anything. The problem is that your method doesn't take a parameter, while it should have at least one : the signal handler should take at least one parameter: the signal sender, plus any other parameters the signal takes. So, if you're connecting to a MenuItem's activate signal, your handler should take a MenuItem argument. (The comments from Jan are also relevant if you're using GtkBuilder) btw, when you say a crash on windows, you mean you didn't test somewhere else, not that it works, right? HTH, Abderrahim ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] [Genie] emulate a mouse click to trigger widget changes
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 b...@ucw.cz ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
[Vala] [Genie] emulate a mouse click to trigger widget changes
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 ? [indent=2] uses Gtk exception WinErr WinNameMissing class MainGui : Gtk.Object prop MainWin : Gtk.Window prop nbMain : Gtk.Notebook builder : private Gtk.Builder init var winXMLName = window var gladeFName = mygui.glade try builder = new Builder () builder.add_from_file (gladeFName) builder.connect_signals (null) MainWin = (Gtk.Window) builder.get_object (winXMLName) if (MainWin.name != winXMLName) raise new WinErr.WinNameMissing (Window Glade definition for + winXMLName + is missing or failed to load!); MainWin.destroy.connect(Gtk.main_quit) // ensure closes properly if NOT closed using the menu MainWin.show_all () nbMain = (Gtk.Notebook) builder.get_object (notebookMain) if (nbMain.name != notebookMain) raise new WinErr.WinNameMissing (Window Glade definition for notebookMain is missing or failed to load!); except e:WinErr stderr.printf (Could not load UI: %s\n, e.message) except e:Error stderr.printf (Could not load UI: %s\n, e.message) [CCode (cname=G_MODULE_EXPORT on_menu_change_tab)] def on_menu_change_tab () stderr.printf (on_menu_change_tab has been called!\n) change_the_tab_somehow() _ Link all your email accounts and social updates with Hotmail. Find out now. http://windowslive.ninemsn.com.au/oneinbox?ocid=T162MSN05A0710G___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list