(debian,eclipse) modify the code of a window created with glade

Discussion in 'Ruby' started by lolveley, Apr 25, 2009.

  1. lolveley

    lolveley Guest

    hello,

    I would like to create a window with glade, import it in a ruby project,
    and add a buton to it but from eclipse.

    here it is an example:

    ************************************************
    #!/usr/bin/env ruby
    #
    require 'libglade2'
    require 'gtk2'
    class MonAppli
    attr_accessor:main_glade_xml
    def initialize(file, root)
    @main_glade_xml = GladeXML.new(file, root) {|handler| method(handler)}
    #@main_glade_xml['fenetre_2'].show_all
    end
    def on_button1_clicked
    puts "clicked !"
    end
    end


    Gtk.init
    a=MonAppli.new("/home/lolveley/eclipse/plan_de_travail/test_1/fenetre_2.glade",nil)

    a.main_glade_xml["window1"].add_child(new Button("bouton 1"))


    # marche
    a.main_glade_xml["window1"].show_all
    Gtk.main
    **********************************************

    but I can't find the correct term to use for "button" : I tried
    Gtk::button but I have this error then : "undefined method `Button' for
    Gtk:Module".

    can you help me?

    olivier.










    ___________________________________________________________________________
    Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
    http://fr.mail.yahoo.com
    lolveley, Apr 25, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    720
  2. Luke Kenneth Casson Leighton
    Replies:
    0
    Views:
    467
    Luke Kenneth Casson Leighton
    Dec 31, 2008
  3. lolveley
    Replies:
    0
    Views:
    137
    lolveley
    Apr 24, 2009
  4. Replies:
    3
    Views:
    114
    kaeli
    Jan 9, 2004
  5. prameela
    Replies:
    0
    Views:
    88
    prameela
    Apr 10, 2006
Loading...

Share This Page