Hi to all,
I am new in ruby and very new in FxRuby.
I copied this little program from an example of fxruby:
equire ‘fox16’
include Fox
class FinestraPrincipale < FXMainWindow
def initialize(app)
Call the base class version of initialize
super(app, “PROGRAMMA PIRAMIDE”, :opts => DECOR_ALL, :x => 20, :y =>
20, :width => 600, :height => 400)
Menubar
menubar = FXMenuBar.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
filemenu = FXMenuPane.new(self)
FXMenuCommand.new(filemenu, “Line 1”)
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”)
FXMenuCommand.new(filemenu, “Line 8”)
FXMenuSeparator.new(filemenu)
FXMenuCommand.new(filemenu, “Line 9”)
FXMenuCommand.new(filemenu, “Information”).connect(SEL_COMMAND) {
FXMessageBox.information(self, MBOX_OK,“information”, “info”)
}
FXMenuSeparator.new(filemenu)
FXMenuCommand.new(filemenu, “&Exit\tCtl-Z”, nil, getApp(),
FXApp::ID_QUIT)
FXMenuTitle.new(menubar, “&MAIN MENU”, nil, filemenu)
Status bar
status = FXStatusBar.new(self,
LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|STATUSBAR_WITH_DRAGCORNER)
@clockLabel = FXLabel.new(status, Time.now().strftime("%I:%M:%S %p"),
nil,
LAYOUT_FILL_Y|LAYOUT_RIGHT|FRAME_SUNKEN)
end
Set choice
def onCmdRadio(sender, sel, ptr)
@choice = FXSELID(sel)
return 1
end
Update menu based on choice
def onUpdRadio(sender, sel, ptr)
sender.check = (FXSELID(sel) == @choice)
return 1
end
Create the main window and show it
def create
super
show(PLACEMENT_SCREEN)
# Create a thread to update the clock
@clockThread = Thread.new(@clockLabel) { |clockLabel|
while true
clockLabel.text = Time.now.strftime("%I:%M:%S %p")
sleep(1)
end
}
end
end
if FILE == $0
Make application
application = FXApp.new(“Groupbox”, “FoxTest”)
Make window
FinestraPrincipale.new(application)
#ProgrammaPiramide.new(application)
Create app
application.create
Run
application.run
end
this program only creates a main window on the screen with a menu bar.
But I am not able to create another window clicking on menu line 1; I
found a lot of examples calling dialog windows but no examples calling
another window to be populated with a new menubar.
Can someone help and tell me how to write instructions to make this
program?
Thank you