# Windows in FxRuby

**URL:** <https://www.ruby-forum.com/t/windows-in-fxruby/149844>\
**Category:** FXRuby\
**Created:** [September 30, 2008, 2:24pm UTC](https://www.ruby-forum.com/t/windows-in-fxruby/149844 "2008-09-30T14:24:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![orsobruno](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/a183cd/32.png) [@orsobruno](https://www.ruby-forum.com/u/orsobruno)\
**Post date:** [September 30, 2008, 2:24pm UTC](https://www.ruby-forum.com/t/windows-in-fxruby/149844/1 "2008-09-30T14:24:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![orsobruno](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/a183cd/32.png) [@orsobruno](https://www.ruby-forum.com/u/orsobruno)\
**Post date:** [December 16, 2012, 5:42pm UTC](https://www.ruby-forum.com/t/windows-in-fxruby/149844/2 "2012-12-16T17:42:44Z")

</div>

You need to raise an FXDialogBox when you click a button in the menu  
line.
