Our World Statistics Day conversations have been a great reminder of how much statistics can inform our lives. Do you have an example of how statistics has made a difference in your life? Share your story with the Community!
Choose Language Hide Translation Bar
Staff (Retired)

Key strokes

For those classic games...you can use the keyboard!


// mouseBox has some keyboard methods that have not been

// documented very well.  Test them to see if they will

// do what you need; there are issues with the mouse box

// losing key focus and issues with special keys (like "s")

// that enter selection-cursor mode and lose the key focus.

// it looks like the numeric keypad and the arrow keys work

// pretty well.

New Window( "test", mb = MouseBox( tb = Text Box( "try the arrow keys" ) ) );

mb << setkey( Function( {this, key}, tb << settext( key ) ) );

mb << setkeyenable( 1 );

mb << setfocus;

This works back to JMP 11.  Feedback here would be great.


Thanks Craige for sharing... this will definitely improve my high scores.

I posted a new version of snake​ with this setkey function to set my 'next direction' variable and it seems to work well

// enable keyboard controls

mb << setkey(

  Function( {this, key},

    If( key == "DOWN",::nextdir = 1);

    If( key == "LEFT",::nextdir = 2);

    If( key == "UP",::nextdir = 3);

    If( key == "RIGHT",::nextdir = 4);



Article Labels

    There are no labels assigned to this post.

Article Tags