Author Topic: Key pressed  (Read 4009 times)

iOtero

  • Sr. Member
  • ****
  • Posts: 414
    • View Profile
Key pressed
« on: May 29, 2019, 12:12:48 PM »
What code should be used in a layout to simulate that a key has been pressed at the start of a layout?, for example, the right arrow key.

Thanks
Nacer a los 15 años Una novela de iOtero

iOtero

  • Sr. Member
  • ****
  • Posts: 414
    • View Profile
Re: Key pressed
« Reply #1 on: June 13, 2019, 02:24:27 AM »
Nobody knows if it can be done or not?
Nacer a los 15 años Una novela de iOtero

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1247
    • View Profile
    • My deviantart page
Re: Key pressed
« Reply #2 on: June 13, 2019, 03:16:50 AM »
I don't think you can simulate any "key" press, instead you can throw a signal, and since these signals include directions you can use something like

Code: [Select]
fe.signal ("right")

To simulate a right button press (or right joystick movement depending on your settings)

Here is an excerpt from https://github.com/mickelson/attract/blob/master/Layouts.md regading fe.signal:

#### `fe.signal()` ####

fe.signal( signal_str )

Signal that a particular frontend action should occur.

Parameters:

    signal_str - the action to signal for. Can be one of the following strings:
        "back"
        "up"
        "down"
        "left"
        "right"
        "select"
        "prev_game"
        "next_game"
        "prev_page"
        "next_page"
        "prev_display"
        "next_display"
        "displays_menu"
        "prev_filter"
        "next_filter"
        "filters_menu"
        "toggle_layout"
        "toggle_movie"
        "toggle_mute"
        "toggle_rotate_right"
        "toggle_flip"
        "toggle_rotate_left"
        "exit"
        "exit_to_desktop"
        "screenshot"
        "configure"
        "random_game"
        "replay_last_game"
        "add_favourite"
        "prev_favourite"
        "next_favourite"
        "add_tags"
        "screen_saver"
        "prev_letter"
        "next_letter"
        "intro"
        "custom1"
        "custom2"
        "custom3"
        "custom4"
        "custom5"
        "custom6"
        "reset_window"
        "reload"

iOtero

  • Sr. Member
  • ****
  • Posts: 414
    • View Profile
Re: Key pressed
« Reply #3 on: June 14, 2019, 06:52:39 AM »
Thanks, zpaolo, its runs perfectly.  :D
« Last Edit: July 26, 2019, 06:10:52 AM by iOtero »
Nacer a los 15 años Una novela de iOtero