Catching F2-F4 in keydown

Posted by: vansen on 8 September 2017, 12:43 pm EST

  • Posted 8 September 2017, 12:43 pm EST

    Hi Everyone,


    i got a problem catching F2-F4 Keys in the keydown event of the spread control. I already looked inside the forums and found some information which isn't working. Obviously the data model has changed (the samples was from 2003) but i tried to match the code as close as possible. I implemented the following lines of code:


    FarPoint.Win.Spread.InputMap im;
    FarPoint.Win.Spread.Keystroke F2 = new FarPoint.Win.Spread.Keystroke(Keys.F2, Keys.None, false);
    FarPoint.Win.Spread.Keystroke F3 = new FarPoint.Win.Spread.Keystroke(Keys.F3, Keys.None, false);
    FarPoint.Win.Spread.Keystroke F4 = new FarPoint.Win.Spread.Keystroke(Keys.F4, Keys.None, false);
    im = fpSpreadMain.GetInputMap(InputMapMode.WhenAncestorOfFocused);
    im.Put(F2, null);
    im.Put(F3, null);


    im.Put(F4, null);


    But the Keys still don't get caught by the event. Am i doing anything wrong here ?


    TIA,


    Oliver

  • Replied 8 September 2017, 12:43 pm EST

    Oliver -

    Have a look at the following post...

    http://www.clubfarpoint.com/Forums/forums/post/3802.aspx
  • Replied 8 September 2017, 12:43 pm EST

    Hi Bob,


    thanks for the reply. I was already referring to this thread. The Code there was the following:


    FarPoint.Win.Spread.InputMap im;
    FarPoint.Win.Spread.Keystroke k = new FarPoint.Win.Spread.Keystroke(Keys.F2, Keys.None, false);
    im = fpSpread1.GetInputMapWhenAncestorOfFocused();
    im.Put(k, FarPoint.Win.Spread.SpreadView.NoneAction );


    I am using Spread 2.5 Latest release (2011). Functions like "GetInputMapWhenAncestorOfFocused" are missing. I posted the code above that gets me closest the this one. I would like to know if I have the right code or if i have to do some more things to get going - because it isn't working.


    Thanks

  • Replied 8 September 2017, 12:43 pm EST

    Oliver,


    Your code was using null when it should have been using the None action.  In your code, replace...


        im.Put(F2, null);
        im.Put(F3, null);
        im.Put(F4, null);


    with...


        im.Put(F2, FarPoint.Win.Spread.SpreadActions.None);
        im.Put(F3, FarPoint.Win.Spread.SpreadActions.None);
        im.Put(F4, FarPoint.Win.Spread.SpreadActions.None);


    Bobby

  • Replied 8 September 2017, 12:43 pm EST

    thanks, perfect
Need extra support?

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

Learn More

Forum Channels