Module: TE3270::Accessors

Defined in:
lib/te3270/accessors.rb

Instance Method Summary collapse

Instance Method Details

#text_field(name, row, column, length, editable = true) ⇒ Object

adds two methods to the screen object - one to set text in a text field, another to retrieve text from a text field.

Examples:

text_field(:first_name, 23,45,20)
# will generate 'first_name', 'first_name=' method

Parameters:

  • the (String)

    name used for the generated methods

  • row (FixedNum)

    number of the location

  • column (FixedNum)

    number of the location

  • length (FixedNum)

    of the text field

  • editable (true|false) (defaults to: true)

    is by default true



19
20
21
22
23
24
25
26
27
# File 'lib/te3270/accessors.rb', line 19

def text_field(name, row, column, length, editable=true)
  define_method(name) do
    platform.get_string(row, column, length)
  end

  define_method("#{name}=") do |value|
    platform.put_string(value, row, column)
  end if editable
end