class RETerm::Components::HSlider

Horizontal Slider, implemented using Slider CDK component

Public Class Methods

new(args={}) click to toggle source

Initialize the HSlider component

@param [Hash] args slider params @option args [String] :title title of slider @option args [String] :label label of slider

Calls superclass method RETerm::Component::new
# File lib/reterm/components/hslider.rb, line 12
def initialize(args={})
  super
  @title = args[:title] || " "
  @label = args[:label] || " "

  @increment     = 1
  @range         = [0, 100]
end

Public Instance Methods

requested_cols() click to toggle source
# File lib/reterm/components/hslider.rb, line 21
def requested_cols
  [@title.size, @label.size].min + 30
end
requested_rows() click to toggle source
# File lib/reterm/components/hslider.rb, line 25
def requested_rows
  4
end

Private Instance Methods

_component() click to toggle source
# File lib/reterm/components/hslider.rb, line 31
def _component
  CDK::SLIDER.new(window.cdk_scr,                       # cdkscreen,
                  CDK::CENTER, CDK::CENTER,             # xplace, yplace
                  @title, @label, '#'.ord,              # title, label, filler,
                  window.cols-6, @range[0], @range[0],  # field_width, start, low,
                  @range[1], @increment, @increment*2,  # high, inc, fast_inc,
                  false, false)                         # box, shadow
end