Sha256: 1687551fd65c77fd8df79346c81a10e8367388b8777c08abdcad72441e4776a1

Contents?: true

Size: 853 Bytes

Versions: 5

Compression:

Stored size: 853 Bytes

Contents

require 'fox12'

module Fox
  #
  # Based on a suggestion from Hugh Sasse on the fxruby-users mailing list,
  # 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.
  #
  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.MKUINT(0, Fox::SEL_KEYPRESS), evt)
      end
    end

    def doKeyRelease
      unless @target.nil?
        evt = FXEvent.new
	evt.type = Fox::SEL_KEYRELEASE
        @target.handle(self, Fox.MKUINT(0, Fox::SEL_KEYRELEASE), evt)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fxruby-1.2.3 lib/fox12/pseudokeyboard.rb
fxruby-1.2.2 lib/fox12/pseudokeyboard.rb
fxruby-1.2.4 lib/fox12/pseudokeyboard.rb
fxruby-1.2.5 lib/fox12/pseudokeyboard.rb
fxruby-1.2.6 lib/fox12/pseudokeyboard.rb