class RETerm::Components::MultiLineEntry

CDK MultiLineEntry Component

Public Class Methods

new(args={}) click to toggle source

Initialize the MultiLineEntry component

@param [Hash] args entry params @option args [String] :title title to assign

to entry

@option args [String] :label label to assign

to entry

@option args [Integer] :min min entry length @option args [Integer] :rows number of logical rows

to create
Calls superclass method RETerm::Component::new
# File lib/reterm/components/multi_line_entry.rb, line 17
def initialize(args={})
  super
  @title   = args[:title] || ""
  @label   = args[:label] || ""
  @min_len = args[:min]   || 0
  @rows    = args[:rows]  || nil
end

Public Instance Methods

requested_cols() click to toggle source
# File lib/reterm/components/multi_line_entry.rb, line 29
def requested_cols
  [@title.size, @label.size + 5].min
end
requested_rows() click to toggle source
# File lib/reterm/components/multi_line_entry.rb, line 25
def requested_rows
  3 + @rows
end

Private Instance Methods

_component() click to toggle source
# File lib/reterm/components/multi_line_entry.rb, line 35
def _component
  width  = window.cols - @label.size - 5
  height = window.rows - 5
  rows   = @rows || height

  CDK::MENTRY.new(window.cdk_scr,            # cdkscreen,
                  CDK::CENTER, CDK::CENTER,  # xpos, ypos
                  @title, @label,            # title, label
                  Ncurses::A_BOLD,           # field attribute (eg typed chars)
                  '.',                       # filler char
                  :MIXED,                    # display type
                  width,                     # field width
                  height,                    # field height (rows)
                  rows,                      # logical rows
                  @min_len,                  # min length
                  false, false)              # box, shadow
end