Sha256: 21e17a36deb6a22e42af72420c01bc58a23f3eb62967641e77eaba723758c4de

Contents?: true

Size: 1.94 KB

Versions: 6

Compression:

Stored size: 1.94 KB

Contents

#!/usr/bin/env ruby

require 'fox14'

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!")
    }
    matrix = FXMatrix.new(menubar, 2, MATRIX_BY_COLUMNS|LAYOUT_FILL_X)
    FXLabel.new(matrix, "sequest.params:", nil,
      JUSTIFY_LEFT|LAYOUT_FILL_X|LAYOUT_CENTER_Y)
    
    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

Version Path
mspire-0.1.3 bin/bioworks2sequestXML_gui.rb
mspire-0.1.7 bin/bioworks2sequestXML_gui.rb
mspire-0.2.1 bin/bioworks2sequestXML_gui.rb
mspire-0.2.2 bin/bioworks2sequestXML_gui.rb
mspire-0.1.5 bin/bioworks2sequestXML_gui.rb
mspire-0.2.0 bin/bioworks2sequestXML_gui.rb