Sha256: 1852e3b5832a8c49e160c0ce8ed0d2e9ad62a3b823cd9e1d540139b0fab0b150

Contents?: true

Size: 1 KB

Versions: 31

Compression:

Stored size: 1 KB

Contents

module Fox
  #
  # 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
  #
  class FXPseudoKeyboard

    attr_accessor :target

    def initialize(tgt=nil)
      @target = tgt
    end
    
    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

    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
  end
end

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
fxruby-1.6.22.pre2-x86-mingw32 lib/fox16/pseudokeyboard.rb
fxruby-1.6.22.pre2 lib/fox16/pseudokeyboard.rb
fxrubi-1.6.22.pre1-x86-mingw32 lib/fox16/pseudokeyboard.rb
fxrubi-1.6.22.pre1 lib/fox16/pseudokeyboard.rb
fxruby-1.6.20-x86-mingw32 lib/fox16/pseudokeyboard.rb
fxruby-1.6.20-x86-linux lib/fox16/pseudokeyboard.rb
fxruby-1.6.20 lib/fox16/pseudokeyboard.rb
fxruby-1.6.20-universal-darwin-10 lib/fox16/pseudokeyboard.rb
fxruby-1.6.19-x86-mingw32 lib/fox16/pseudokeyboard.rb
fxruby-1.6.14-mswin32 lib/fox16/pseudokeyboard.rb
fxruby-1.6.13-mswin32 lib/fox16/pseudokeyboard.rb
fxruby-1.6.11 lib/fox16/pseudokeyboard.rb
fxruby-1.6.12 lib/fox16/pseudokeyboard.rb
fxruby-1.6.13 lib/fox16/pseudokeyboard.rb
fxruby-1.6.14-universal-darwin-9 lib/fox16/pseudokeyboard.rb
fxruby-1.6.15-universal-darwin-9 lib/fox16/pseudokeyboard.rb
fxruby-1.6.14 lib/fox16/pseudokeyboard.rb
fxruby-1.6.15 lib/fox16/pseudokeyboard.rb
fxruby-1.6.15-x86-mswin32-60 lib/fox16/pseudokeyboard.rb
fxruby-1.6.16-universal-darwin-9 lib/fox16/pseudokeyboard.rb