Method: CDK::CDKOBJS#getc

Defined in:
lib/cdk/cdk_objs.rb

#getcObject



268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'lib/cdk/cdk_objs.rb', line 268

def getc
  cdktype = self.object_type
  test = self.bindableObject(cdktype)
  result = @input_window.wgetch

  if result >= 0 && !(test.nil?) && test.binding_list.include?(result) &&
      test.binding_list[result][0] == :getc
    result = test.binding_list[result][1]
  elsif test.nil? || !(test.binding_list.include?(result)) ||
      test.binding_list[result][0].nil?
    case result
    when "\r".ord, "\n".ord
      result = Ncurses::KEY_ENTER
    when "\t".ord
      result = CDK::KEY_TAB
    when CDK::DELETE
      result = Ncurses::KEY_DC
    when "\b".ord
      result = Ncurses::KEY_BACKSPACE
    when CDK::BEGOFLINE
      result = Ncurses::KEY_HOME
    when CDK::ENDOFLINE
      result = Ncurses::KEY_END
    when CDK::FORCHAR
      result = Ncurses::KEY_RIGHT
    when CDK::BACKCHAR
      result = Ncurses::KEY_LEFT
    when CDK::NEXT
      result = CDK::KEY_TAB
    when CDK::PREV
      result = Ncurses::KEY_BTAB
    end
  end

  return result
end