Managing Keyboard

Posted by: pansy18 on 8 September 2017, 12:38 pm EST

  • Posted 8 September 2017, 12:38 pm EST

    <font color="#000000" face="Times New Roman"><img alt=""><img alt=""><img alt=""><img alt=""><img alt=""><img alt=""><img alt=""><img alt=""><img alt="">I have a sheet (30 rows and 25 columns) and on it have a cell with type is <b>button</b>. This sheet is placed in a from. On this form has 'Start' button and a combo box with three speed values:  Hight, Slow and  Medium. When I choose one speed and click Start button, </font><font color="#000000" face="Times New Roman"><b>button</b> on sheet will go down bellow rows with chose speed, and i can use </font><span><font color="#000000" face="Times New Roman">Left/Right/Down to control direct of <b>button</b> on sheet. If button down to row 30 a the process will be paly again. I don't know how to use Keyboard to control button on the sheet?  Please, give me an Ideal to solve this  problem.
    Thank you so much! </font>
  • Replied 8 September 2017, 12:38 pm EST

    What are you wanting to happen when you reach the last row?  Could you attach a small example showing what you are doing and explain what you would like the behavior to be?
  • Replied 8 September 2017, 12:38 pm EST

    Do you know about this Game! I want to use Keyboard Left/Right/Down to control direction of  these blocks and Space to rotate them. When a row full of these blog, it will be remove and score will be increase 10 point.
    In this game I want to managing keyboard interaction to develop.

  • Replied 8 September 2017, 12:38 pm EST

    I am not familiar with that game.  Again, could you put together a small project that explains what you want to do.   You should be able to move the buttons programatically in one of the key events, but this is not going to be an easy thing to do.
  • Replied 8 September 2017, 12:38 pm EST


    You would need to turn off the preprocessing of these keystrokes in the Spread. Then the keystroke will work it's way to the parent form and you can catch it in the ProcessDialogKey override for the parent form. To turn off Spread's preprocessing of the keystrokes, you need to use the InputMap and set the SpreadAction assigned to the keystroke to None. Here is sample code showing how to catch these keystrokes in the Spread.

      <SPAN class=kwd>Private Sub</SPAN> Form1_Load(<SPAN class=kwd>ByVal</SPAN> sender <SPAN class=kwd>As</SPAN> System.<SPAN class=kwd>Object</SPAN>, <SPAN class=kwd>ByVal</SPAN> e <SPAN class=kwd>As</SPAN> System.EventArgs) <SPAN class=kwd>Handles MyBase</SPAN>.Load
    FpSpread1.Sheets(0).OperationMode = FarPoint.Win.Spread.OperationMode.<SPAN class=kwd>ReadOnly
    Dim</SPAN> im <SPAN class=kwd>As</SPAN> FarPoint.Win.Spread.InputMap
    im = FpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused, FarPoint.Win.Spread.OperationMode.<SPAN class=kwd>ReadOnly</SPAN>)
    im.Put(<SPAN class=kwd>New</SPAN> FarPoint.Win.Spread.Keystroke(Keys.Down, Keys.None), FarPoint.Win.Spread.SpreadActions.None)
    im.Put(<SPAN class=kwd>New</SPAN> FarPoint.Win.Spread.Keystroke(Keys.Left, Keys.None), FarPoint.Win.Spread.SpreadActions.None)
    im.Put(<SPAN class=kwd>New</SPAN> FarPoint.Win.Spread.Keystroke(Keys.Right, Keys.None), FarPoint.Win.Spread.SpreadActions.None)
    im.Put(<SPAN class=kwd>New</SPAN> FarPoint.Win.Spread.Keystroke(Keys.Space, Keys.None), FarPoint.Win.Spread.SpreadActions.None)
    <SPAN class=kwd>End Sub

    Protected Overrides Function</SPAN> ProcessDialogKey(<SPAN class=kwd>ByVal</SPAN> keyData <SPAN class=kwd>As</SPAN> System.Windows.Forms.Keys) <SPAN class=kwd>As Boolean</SPAN>
    TextBox1.Text = keyData
    <SPAN class=kwd>Return MyBase</SPAN>.ProcessDialogKey(keyData)
    <SPAN class=kwd>End Function</SPAN>
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels