🏢 PlaceMaker | 25% off for February including new Google Earth data imports!
Learn more
Fxruby
-
I am creating this little program that shows a main window with a menu:
require 'fox16' require 'fox16/colors' include Fox class Finestra0 < FXMainWindow def initialize(app) # Initialize base class super(app, "PROGRAMMA", ;opts => DECOR_ALL, ;x => 20, ;y => 20, ;width => 600, ;height => 400) # Create another integer data target to track the "progress" #@progressTarget = FXDataTarget.new(0) @area = FXCanvas.new(self) # Menubar menubar = FXMenuBar.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X) # File menu filemenu = FXMenuPane.new(self) archivitabellemenu = FXMenuPane.new(self) #THESE INSTRUCIONS DO NOT WORK FXMenuCommand.new(archivitabellemenu, "Line 11").connect(SEL_COMMAND) { finestra = FXWindow.new(self, x = 20, y = 20, width = 600, height = 400) finestra.create finestra.show } FXMenuCommand.new(archivitabellemenu, "Line 12") FXMenuCommand.new(archivitabellemenu, "Line 13") FXMenuCommand.new(archivitabellemenu, "Line 14") FXMenuCommand.new(archivitabellemenu, "Line 15") FXMenuCommand.new(archivitabellemenu, "Line 16") FXMenuCommand.new(archivitabellemenu, "Line 17") FXMenuCommand.new(archivitabellemenu, "Line 18") FXMenuCascade.new(filemenu, "Line 1", ;popupMenu => archivitabellemenu) FXMenuCommand.new(filemenu, "Line 2") FXMenuCommand.new(filemenu, "Line 3") FXMenuCommand.new(filemenu, "Line 4") FXMenuCommand.new(filemenu, "Line 5") FXMenuCommand.new(filemenu, "Line 6") FXMenuCommand.new(filemenu, "Line 7") amministrazionemenu = FXMenuPane.new(self) FXMenuCommand.new(amministrazionemenu, "Line 21") FXMenuCommand.new(amministrazionemenu, "Line 22") FXMenuCommand.new(amministrazionemenu, "Line 23") FXMenuCascade.new(filemenu, "Line 8", ;popupMenu => amministrazionemenu) FXMenuSeparator.new(filemenu) FXMenuCommand.new(filemenu, "Line 9") FXMenuCommand.new(filemenu, "Line 10").connect(SEL_COMMAND) { FXMessageBox.information(self, MBOX_OK, "Hello World") } FXMenuSeparator.new(filemenu) FXMenuCommand.new(filemenu, "Fine lavoro\tCtl-Z", nil, getApp(), FXApp;;ID_QUIT) FXMenuTitle.new(menubar, "Menu Principale", nil, ;popupMenu => filemenu) FXHorizontalSeparator.new(self, LAYOUT_SIDE_TOP|SEPARATOR_GROOVE|LAYOUT_FILL_X) end # Quit def onCmdQuit(sender, sel, ptr) getApp.exit(0) end # Start def create # Create window super # Show the main window show(PLACEMENT_SCREEN) end end if __FILE__ == $0 # Make an application application = FXApp.new("DataTarget", "FoxTest") # Create main window window = Finestra0.new(application) # Handle interrupts to quit application gracefully application.addSignal("SIGINT", window.method(;onCmdQuit)) # Create the application application.create # Run application.run end
clicking on line 11 I want to open another window, but the instucions I entered do not work.
I am not able to open another window: can someone help me?Bye
Italian Ruby user
-
Advertisement