class Canis::TabbedWindow

Attributes

tabbed_pane[R]

Public Class Methods

new(config={}) click to toggle source

The given block is passed to the TabbedPane The given dimensions are used to create the window. The TabbedPane is placed at 0,0 and fills the window.

# File lib/canis/core/widgets/rtabbedwindow.rb, line 28
def initialize config={}, &block

  h = config.fetch(:height, 0)
  w = config.fetch(:width, 0)
  t = config.fetch(:row, 0)
  l = config.fetch(:col, 0)
  @window = Canis::Window.new :height => h, :width => w, :top => t, :left => l
  @form = Form.new @window
  config[:row] = config[:col] = 0
  @tabbed_pane = TabbedPane.new @form, config , &block
end

Public Instance Methods

run() click to toggle source

returns button index Call this after instantiating the window

# File lib/canis/core/widgets/rtabbedwindow.rb, line 41
def run
  @form.repaint
  @window.wrefresh
  return handle_keys
end

Private Instance Methods

handle_keys() click to toggle source

returns button index

# File lib/canis/core/widgets/rtabbedwindow.rb, line 48
def handle_keys
  buttonindex = catch(:close) do 
    while((ch = @window.getchar()) != FFI::NCurses::KEY_F10 )
      break if ch == ?\C-q.getbyte(0) 
      begin
        @form.handle_key(ch)
        @window.wrefresh
      rescue => err
        $log.debug( err) if err
        $log.debug(err.backtrace.join("\n")) if err
        textdialog ["Error in TabbedWindow: #{err} ", *err.backtrace], :title => "Exception"
        $error_message.value = ""
      ensure
      end

    end # while loop
  end # close
  $log.debug "XXX: CALLER GOT #{buttonindex} "
  @window.destroy
  return buttonindex 
end