Class: Wx::UIActionSimulator
- Inherits:
-
Object
- Object
- Wx::UIActionSimulator
- Defined in:
- lib/wx/doc/gen/ui_action_simulator.rb
Overview
This class is untracked and should not be derived from nor instances extended!
UIActionSimulator is a class used to simulate user interface actions such as a mouse click or a key press.
Common usage for this class would be to provide playback and record (aka macro recording) functionality for users, or to drive unit tests by simulating user sessions. See the wxUIActionSimulator Sample for an example of using this class.
This class currently doesn't work when using Wayland with WXGTK.
Instance Method Summary collapse
-
#char(keycode, modifiers = Wx::KeyModifier::MOD_NONE) ⇒ Boolean
Press and release a key.
-
#initialize ⇒ Wx::UIActionSimulator
constructor
Default constructor.
-
#key_down(keycode, modifiers = Wx::KeyModifier::MOD_NONE) ⇒ Boolean
Press a key.
-
#key_up(keycode, modifiers = Wx::KeyModifier::MOD_NONE) ⇒ Boolean
Release a key.
-
#mouse_click(button = Wx::MouseButton::MOUSE_BTN_LEFT) ⇒ Boolean
Click a mouse button.
-
#mouse_dbl_click(button = Wx::MouseButton::MOUSE_BTN_LEFT) ⇒ Boolean
Double-click a mouse button.
-
#mouse_down(button = Wx::MouseButton::MOUSE_BTN_LEFT) ⇒ Boolean
Press a mouse button.
-
#mouse_drag_drop(x1, y1, x2, y2, button = Wx::MouseButton::MOUSE_BTN_LEFT) ⇒ Boolean
Perform a drag and drop operation.
- #mouse_move(*args) ⇒ Object
-
#mouse_up(button = Wx::MouseButton::MOUSE_BTN_LEFT) ⇒ Boolean
Release a mouse button.
-
#select(text) ⇒ Boolean
Simulate selection of an item with the given text.
-
#text(text) ⇒ Boolean
Emulate typing in the keys representing the given string.
Constructor Details
#initialize ⇒ Wx::UIActionSimulator
Default constructor.
27 |
# File 'lib/wx/doc/gen/ui_action_simulator.rb', line 27 def initialize; end |
Instance Method Details
#char(keycode, modifiers = Wx::KeyModifier::MOD_NONE) ⇒ Boolean
Press and release a key.
87 |
# File 'lib/wx/doc/gen/ui_action_simulator.rb', line 87 def char(keycode, modifiers=Wx::KeyModifier::MOD_NONE) end |
#key_down(keycode, modifiers = Wx::KeyModifier::MOD_NONE) ⇒ Boolean
Press a key.
If you are using modifiers then it needs to be paired with an identical KeyUp or the modifiers will not be released (MSW and macOS).
75 |
# File 'lib/wx/doc/gen/ui_action_simulator.rb', line 75 def key_down(keycode, modifiers=Wx::KeyModifier::MOD_NONE) end |
#key_up(keycode, modifiers = Wx::KeyModifier::MOD_NONE) ⇒ Boolean
Release a key.
81 |
# File 'lib/wx/doc/gen/ui_action_simulator.rb', line 81 def key_up(keycode, modifiers=Wx::KeyModifier::MOD_NONE) end |
#mouse_click(button = Wx::MouseButton::MOUSE_BTN_LEFT) ⇒ Boolean
Click a mouse button.
53 |
# File 'lib/wx/doc/gen/ui_action_simulator.rb', line 53 def mouse_click(=Wx::MouseButton::MOUSE_BTN_LEFT) end |
#mouse_dbl_click(button = Wx::MouseButton::MOUSE_BTN_LEFT) ⇒ Boolean
Double-click a mouse button.
58 |
# File 'lib/wx/doc/gen/ui_action_simulator.rb', line 58 def mouse_dbl_click(=Wx::MouseButton::MOUSE_BTN_LEFT) end |
#mouse_down(button = Wx::MouseButton::MOUSE_BTN_LEFT) ⇒ Boolean
Press a mouse button.
43 |
# File 'lib/wx/doc/gen/ui_action_simulator.rb', line 43 def mouse_down(=Wx::MouseButton::MOUSE_BTN_LEFT) end |
#mouse_drag_drop(x1, y1, x2, y2, button = Wx::MouseButton::MOUSE_BTN_LEFT) ⇒ Boolean
Perform a drag and drop operation.
67 |
# File 'lib/wx/doc/gen/ui_action_simulator.rb', line 67 def mouse_drag_drop(x1, y1, x2, y2, =Wx::MouseButton::MOUSE_BTN_LEFT) end |
#mouse_move(x, y) ⇒ Boolean #mouse_move(point) ⇒ Boolean
38 |
# File 'lib/wx/doc/gen/ui_action_simulator.rb', line 38 def mouse_move(*args) end |
#mouse_up(button = Wx::MouseButton::MOUSE_BTN_LEFT) ⇒ Boolean
Release a mouse button.
48 |
# File 'lib/wx/doc/gen/ui_action_simulator.rb', line 48 def mouse_up(=Wx::MouseButton::MOUSE_BTN_LEFT) end |
#select(text) ⇒ Boolean
Simulate selection of an item with the given text.
This method selects an item in the currently focused Choice, ComboBox, ListBox and similar controls. It does it by simulating keyboard events, so the behaviour should be the same as if the item was really selected by the user. Notice that the implementation of this method uses yield and so events can be dispatched from it.
true if the item text was successfully selected or false if the currently focused window is not one of the controls allowing item selection or if the item with the given text was not found in it.
97 |
# File 'lib/wx/doc/gen/ui_action_simulator.rb', line 97 def select(text) end |
#text(text) ⇒ Boolean
Emulate typing in the keys representing the given string.
Currently only the ASCII letters are universally supported. Digits and punctuation characters can be used with the standard QWERTY (US) keyboard layout but may not work with other layouts.
104 |
# File 'lib/wx/doc/gen/ui_action_simulator.rb', line 104 def text(text) end |