[Vala] [Genie] emulate a mouse click to trigger widget changes
- From: James Parkinson <jlp765 hotmail com>
- To: <vala-list gnome org>
- Subject: [Vala] [Genie] emulate a mouse click to trigger widget changes
- Date: Wed, 10 Mar 2010 10:36:13 +1000
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]