Hello All,
I’m new to the list and to Ruby.
I was trying to use one of the examples as a skeleton for something that
I’m working on.
I’m currently stuck when it comes to adding another item to the
sub-menus.
I have a menu item by the name of “Tools” and I would like to add a
sub-menu item called “Find Unique Fields” but it doesn’t show up when I
try to run it.
If I add a Wx::ID_UNIQUE and a handle for the event the program fails.
What do I need to do or what I’m I missing. I appreciate your response.
Thanks,
Glenn
#!/usr/bin/env ruby
begin
…
…
…
class HL7Query < Wx::Frame
def initialize(title)
super(nil, :title => title, :size => [ 850, 600 ])
menu_bar = Wx::MenuBar.new
# The "file" menu
menu_file = Wx::Menu.new
menu_file.append(Wx::ID_EXIT, "E&xit\tAlt-X", "Quit this program")
menu_bar.append(menu_file, "&File")
# The "Tools" menu
menu_tools = Wx::Menu.new
#menu_tools.append(Wx::ID_UNIQUEFIELDS, "Find Unique Fields", "Find
Unique Fields")
menu_tools.append(nil, “Find Unique Fields”, “Find Unique Fields”)
menu_bar.append(menu_tools, “Tools”)
# The "help" menu
menu_help = Wx::Menu.new
# Using Wx::ID_ABOUT default id means the menu item will be placed
# in the correct platform-specific place - eg on OS X
menu_help.append(Wx::ID_ABOUT, "&About...\tF1", "Show about dialog")
menu_bar.append(menu_help, "&Help")
# Assign the menubar to this frame
self.menu_bar = menu_bar
# Create a status bar
create_status_bar(2)
self.status_text = "Welcome to HL7Query!"
# Set it up to handle menu events using the relevant methods
evt_menu Wx::ID_EXIT, :on_quit
evt_menu Wx::ID_ABOUT, :on_about
end
def on_quit
close()
end
…
…
…
Wx::App.run do
self.app_name = ‘HL7Query’
frame = HL7Query.new(":::HL7Query:::")
frame.show
end