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: > > <snip> > >> 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, "<Branch>", nil, nil], > ["/File/_New", "<ctrl>N", "<Item>", pn("New"), nil], > ["/File/_Quit", "<ctrl>Q", "<Item>", pn("Quit"),nil], > ["/_Edit", nil, "<Branch>", nil, nil], > ["/_Help", nil, "<LastBranch>", nil, nil], > ["/Help/_About","<ctrl>A", "<Item>", pn("H/A"), nil] > ] > accel=Gtk::AccelGroup.new > fact=Gtk::ItemFactory.new(Gtk::ItemFactory::TYPE_MENU_BAR,"<main>",accel) > fact.create_items(items) > menu_bar=fact.get_widget("<main>") > vbox=Gtk::VBox.new > vbox.add(menu_bar) > add(vbox) > show_all > end > end > > SampleWindow.new > Gtk::main