From: Markus Jais Date: 2002-01-25T15:51:41+09:00 Subject: Re: Ruby/Gtk : question on menus hello thank you very much. now it works! do you know why the order of the arguments in "items" is different than in C or PyGtk??? markus wbh wrote: > On Fri, 25 Jan 2002, Markus Jais wrote: > > > >> first is the output of "print_and_quit" function. >> how can I define a function within the "items" array????? >> ("print_and_quit" and &print_and_quit and { print_and_quit } do not work >> ) > > It's invoking the call method of the object passed in. > >> why does the app crash?? > > The order of the parameters seems to be different from C > Accellerators need some playing with still... > > require "gtk" > > class SampleWindow < Gtk::Window > def pn(msg) > return Proc.new {puts msg,"\n"} > end > def initialize > super > items=[ > ["/_File", nil, "", nil, nil], > ["/File/_New", "N", "", pn("New"), nil], > ["/File/_Quit", "Q", "", pn("Quit"),nil], > ["/_Edit", nil, "", nil, nil], > ["/_Help", nil, "", nil, nil], > ["/Help/_About","A", "", pn("H/A"), nil] > ] > accel=Gtk::AccelGroup.new > fact=Gtk::ItemFactory.new(Gtk::ItemFactory::TYPE_MENU_BAR,"
",accel) > fact.create_items(items) > menu_bar=fact.get_widget("
") > vbox=Gtk::VBox.new > vbox.add(menu_bar) > add(vbox) > show_all > end > end > > SampleWindow.new > Gtk::main