Class: Fox::FXPseudoKeyboard
- Inherits:
-
Object
- Object
- Fox::FXPseudoKeyboard
- Defined in:
- lib/fox16/pseudokeyboard.rb
Overview
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
Instance Attribute Summary collapse
-
#target ⇒ Object
Returns the value of attribute target.
Instance Method Summary collapse
- #doKeyPress ⇒ Object
- #doKeyRelease ⇒ Object
-
#initialize(tgt = nil) ⇒ FXPseudoKeyboard
constructor
A new instance of FXPseudoKeyboard.
Constructor Details
#initialize(tgt = nil) ⇒ FXPseudoKeyboard
Returns a new instance of FXPseudoKeyboard.
19 20 21 |
# File 'lib/fox16/pseudokeyboard.rb', line 19 def initialize(tgt=nil) @target = tgt end |
Instance Attribute Details
#target ⇒ Object
Returns the value of attribute target.
17 18 19 |
# File 'lib/fox16/pseudokeyboard.rb', line 17 def target @target end |
Instance Method Details
#doKeyPress ⇒ Object
23 24 25 26 27 28 29 |
# 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 ⇒ Object
31 32 33 34 35 36 37 |
# 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 |