Class | Ui::WxWidgets::Dialogs::NoteDialog |
In: |
ui/wx/dialogs/note.rb
|
Parent: | Wx::Dialog |
# File ui/wx/dialogs/note.rb, line 28 def initialize(parent=nil) super() # TODO: think about a way of sharing this XmlResource between # different wx components xml = Wx::XmlResource.get(); xml.init_all_handlers(); xml.load("ui/wx/dialogs/note.xrc") # # Load the dialog from XRC. We define $xml in on_init. # We could use XmlResource.get() over and over again, but # honestly, thats just too much work. # xml.load_dialog_subclass(self,parent,'ID_NOTEDIALOG') # # Get the buttons. Note we use 'xrcid' much like the XRCID macro # in C++. Make sure the id's actually exist, or your program will crash! # @author = Wx::Window.find_window_by_id(Wx::xrcid('ID_AUTHOR'),self) @category = Wx::Window.find_window_by_id(Wx::xrcid('ID_CATEGORY'),self) @text = Wx::Window.find_window_by_id(Wx::xrcid('ID_TEXT'),self) # # Bind the buttons to event handlers # evt_button(Wx::xrcid('wxID_OK')) do end_modal(Wx::ID_OK) end evt_button(Wx::xrcid('wxID_CANCEL')) do end_modal(Wx::ID_CANCEL) end end
# File ui/wx/dialogs/note.rb, line 74 def categories=(category_list) @category.clear category_list.each do |c| id = @category.append(c.name) @category.set_item_data(id, c.id) end @category.set_selection(0) end
# File ui/wx/dialogs/note.rb, line 67 def category_id() @category.get_item_data(@category.get_selection) end