Method: CDK::BUTTONBOX#activate

Defined in:
lib/cdk/buttonbox.rb

#activate(actions) ⇒ Object

This activates the widget.



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/cdk/buttonbox.rb', line 121

def activate(actions)
  # Draw the buttonbox box.
  self.draw(@box)

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

      # Inject the characer 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)
      if @exit_type != :EARLY_EXIT
        return ret
      end
    end
  end

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