Method: CDK::SCALE#activate

Defined in:
lib/cdk/scale.rb

#activate(actions) ⇒ Object

This allows the person to use the widget’s data field.



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/cdk/scale.rb', line 134

def activate(actions)
  ret = -1
  # Draw the widget.
  self.draw(@box)

  if actions.nil? || actions.size == 0
    input = 0
    while true
      input = self.getch([])

      # Inject the character into the widget.
      ret = self.inject(input)
      if @exit_type != :EARLY_EXIT
        return ret
      end
    end
  else
    # Inject each character one at a time.
    actions.each do |action|
      ret = self.inject(action)
    end
    if @exit_type != :EARLY_EXIT
      return ret
    end
  end

  # Set the exit type and return.
  self.setExitType(0)
  return ret
end