class Fox::FXPseudoKeyboard

An FXPseudoKeyboard object provides a simple means to operate widgets programmatically, to aid test driven design. An FXPseudoKeyboard instance can be pointed at an FXObject and will manage the sending of events to it.

For example:

textfield = FXTextField.new(...)
pk = FXPseudoKeyboard.new(textfield)
pk.doKeyPress     # sends a SEL_KEYPRESS message to the textfield
pk.doKeyRelease   # sends a SEL_KEYRELEASE message to the textfield

Attributes

target[RW]

Public Class Methods

new(tgt=nil) click to toggle source
# File lib/fox16/pseudokeyboard.rb, line 19
def initialize(tgt=nil)
  @target = tgt
end

Public Instance Methods

doKeyPress() click to toggle source
# File lib/fox16/pseudokeyboard.rb, line 23
def doKeyPress
  unless @target.nil?
    evt = FXEvent.new
    evt.type = Fox::SEL_KEYPRESS
    @target.handle(self, Fox.FXSEL(Fox::SEL_KEYPRESS, 0), evt)
  end
end
doKeyRelease() click to toggle source
# File lib/fox16/pseudokeyboard.rb, line 31
def doKeyRelease
  unless @target.nil?
    evt = FXEvent.new
    evt.type = Fox::SEL_KEYRELEASE
    @target.handle(self, Fox.FXSEL(Fox::SEL_KEYRELEASE, 0), evt)
  end
end