[ruby-gnome2-doc-cvs] [Ruby-GNOME2 Project Website] update - tut-gtk2-dynui-libglade

アーカイブの一覧に戻る

ruby-****@sourc***** ruby-****@sourc*****
2009年 3月 5日 (木) 23:36:39 JST


-------------------------
REMOTE_ADDR = 74.15.84.244
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-dynui-libglade
-------------------------
@@ -81,6 +81,36 @@
    Gtk.main
  end
 
+However you can not yet run this program as is. You must first make your main window visible. To do this you must first capture the (YourApplication)Glade object into a variable. In our case this object is ((*BrowserGlade*)) object. In the above program you would change the following line:
+  
+   BrowserGlade.new(PROG_PATH, nil, PROG_NAME)
+
+to something like:
+
+   o = BrowserGlade.new(PROG_PATH, nil, PROG_NAME)
+
+And lastly you would add the following two lines just before the "Gtk.main" statement:
+
+   window = o.glade.get_widget("window")
+   window.show_all
+
+Hence, the last part of our ((*browser.rb*)) program now looks like the following:
+
+ # Main program
+ if __FILE__ == $0
+   # Set values as your own application. 
+   PROG_PATH = "browser.glade"
+   PROG_NAME = "YOUR_APPLICATION_NAME"
+   BrowserGlade.new(PROG_PATH, nil, PROG_NAME)
+   o = BrowserGlade.new(PROG_PATH, nil, PROG_NAME)
+   window = o.glade.get_widget("window")
+   window.show_all
+   Gtk.main
+ end
+
+After you add the above " missing" code you may run your output ((*browser.rb*)) program. Indeed, you would need to implement the all the callback methods, but one should be fixed immediately, namely: 
+
+
 After you add the necessary code mentioned above to the output ((*(browser.rb)*)) program, you may run it.  Indeed, you would need to implement the all the callback methods, but one should be fixed immediately, namely: 
 
  def gtk_main_quit(widget)




ruby-gnome2-cvs メーリングリストの案内
アーカイブの一覧に戻る