class RETerm::Components::Entry
Attributes
title[RW]
Public Class Methods
new(args={})
click to toggle source
Initialize the Entry
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] :max max entry length
Calls superclass method
RETerm::Component::new
# File lib/reterm/components/entry.rb, line 18 def initialize(args={}) super @title = args[:title] || "" @label = args[:label] || "" @min_len = args[:min] || 0 @max_len = args[:max] || 100 @min_size = args[:size] || 0 end
Public Instance Methods
requested_cols()
click to toggle source
# File lib/reterm/components/entry.rb, line 31 def requested_cols [@title.size, @label.size, @min_size].max + 3 end
requested_rows()
click to toggle source
# File lib/reterm/components/entry.rb, line 27 def requested_rows 5 end
value()
click to toggle source
# File lib/reterm/components/entry.rb, line 35 def value component.getValue end
value=(v)
click to toggle source
# File lib/reterm/components/entry.rb, line 39 def value=(v) component.setValue(v) end
Private Instance Methods
_component()
click to toggle source
# File lib/reterm/components/entry.rb, line 49 def _component c = CDK::ENTRY.new(window.cdk_scr, # cdkscreen, CDK::CENTER, CDK::CENTER, # xpos, ypos @title, @label, # title, label Ncurses::A_NORMAL, # field attribute (eg typed chars) '.'.ord, # filler char disp_type, # display type window.cols-@label.size-5, # field width 0, 512, # min/max len false, false) # box, shadow e = self callback = lambda do |cdktype, entry, component, key| component.dispatch :entry, key end c.setPostProcess(callback, self) c end
disp_type()
click to toggle source
# File lib/reterm/components/entry.rb, line 45 def disp_type :MIXED end