Author Topic: Signal handling removing key repeat  (Read 1925 times)

8bitsdeep

  • Full Member
  • ***
  • Posts: 49
    • View Profile
Signal handling removing key repeat
« on: March 28, 2020, 09:10:57 PM »
Normally when you hold down an arrow key, the key repeat triggers and AM will quickly start scrolling through your list. However, my current theme scrolls sideways instead of vertically, so I handled the signals accordingly in the script to keep things intuitive for the user without having to remap controls specifically for my theme. But doing this stops key repeat from working.

Code: [Select]
fe.add_signal_handler( this, "on_signal" );
function on_signal( sig ) {
    if(sig == "left"){
        fe.list.index--;
        return true;
    }
    else if(sig == "right"){
        fe.list.index++;
        return true;
    }
    else return false;
}

Is there a way to fix this or perhaps a better way to handle a horizontal scroll input?

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: Signal handling removing key repeat
« Reply #1 on: March 29, 2020, 08:03:16 AM »
here you are. my friend

should work good.

Code: [Select]
function on_signal( sig )
{
switch ( sig )
{


case "up":
fe.signal( "" );
 
return true;


case "down":
fe.signal( "" );

return true


case "left":
fe.signal( "prev_game" );

return true;


case "right":
fe.signal( "next_game" );

return true;

case "select":
default:

}

return false;
}

fe.add_signal_handler(this, "on_signal");
help a friend....

8bitsdeep

  • Full Member
  • ***
  • Posts: 49
    • View Profile
Re: Signal handling removing key repeat
« Reply #2 on: March 29, 2020, 12:00:37 PM »
Perfect, thank you!