Sha256: 70faed54389484e8afbef6ae7822e8f86fd1a668f09c80131bb89074b603ef05
Contents?: true
Size: 1.71 KB
Versions: 6
Compression:
Stored size: 1.71 KB
Contents
#!/usr/bin/env ruby require 'fox16' include Fox class DirListWindow < FXMainWindow def initialize(app) # Invoke the base class initialize first super(app, "Directory List", nil, nil, DECOR_ALL, 0, 0, 800, 600) # Make menu bar menubar = FXMenuBar.new(self, LAYOUT_FILL_X) filemenu = FXMenuPane.new(self) FXMenuCommand.new(filemenu, "&Quit\tCtl-Q", nil, getApp(), FXApp::ID_QUIT) FXMenuTitle.new(menubar, "&File", nil, filemenu) helpmenu = FXMenuPane.new(self) FXMenuCommand.new(helpmenu, "&About FOX...").connect(SEL_COMMAND) { FXMessageBox.information(self, MBOX_OK, "About FOX", "FOX is a really, really cool C++ library...\n" + "and FXRuby is an even cooler GUI for Ruby!") } FXMenuTitle.new(menubar, "&Help", nil, helpmenu, LAYOUT_RIGHT) # Text field at bottom text = FXTextField.new(self, 10, nil, 0, LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|FRAME_SUNKEN|FRAME_THICK) # Make contents dirlist = FXDirList.new(self, nil, 0, (HSCROLLING_OFF| TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES|FRAME_SUNKEN|FRAME_THICK| LAYOUT_FILL_X|LAYOUT_FILL_Y), 0, 0, 0, 0) # Now make the directory list widget (dirlist) the message target # for the text field. If you type a new directory name in the text # field the directory list should navigate to that directory. text.target = dirlist text.selector = FXWindow::ID_SETVALUE end # Create and show the main window def create super show(PLACEMENT_SCREEN) end end def run # Make application application = FXApp.new("DirList", "FoxTest") # Make window DirListWindow.new(application) # Create app application.create # Run application.run end run
Version data entries
6 entries across 6 versions & 1 rubygems