NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 8 9 10 11 12 … 93 Next »
NewStyleButtonListPlugin - handling keypresses

 
  • 0 Vote(s) - 0 Average
NewStyleButtonListPlugin - handling keypresses
psycik
Offline

Posting Freak

Posts: 5,210
Threads: 424
Joined: Sep 2005
#1
2012-12-14, 06:52 AM
Is this possible?

I want to handle the control-w (prev channel) keypress in a plugin. I tried overriding the Onkeydown method but it stopped handling all keypresses entirely,.


Or if that not possible maybe allowing more than 4 buttons on the top?
whurlston
Offline

Posting Freak

Posts: 7,885
Threads: 102
Joined: Nov 2006
#2
2012-12-14, 07:05 AM
Return true for any keypresses you handle and return base.OnKeyDown(e) for everything else. Stripped down version from YouTube:

Code:
public override bool OnKeyDown(System.Windows.Forms.KeyEventArgs e)
{
    // If CTRL was not pressed we don't care about it so return immediately
    if (e.Modifiers != System.Windows.Forms.Keys.Control)
    return base.OnKeyDown(e);

    // Get the key combinations we want.
    switch (e.KeyCode)
    {
    case System.Windows.Forms.Keys.S:
        goto StopPressed;
    case System.Windows.Forms.Keys.P:
        goto PlayPressed;
    case System.Windows.Forms.Keys.K:
        goto RecordPressed;
    }
        
    // If we got here, these are not the droids we are looking for.
    return base.OnKeyDown(e);
            
    StopPressed:
    HandleCommand("Sort"); // Example
    return true;

    PlayPressed:
    // Do stuff here and return
    return true;

    RecordPressed:
    // Do stuff here and return
    return true;
}
psycik
Offline

Posting Freak

Posts: 5,210
Threads: 424
Joined: Sep 2005
#3
2012-12-14, 07:14 AM
Oh yeah, ta, forgot the base.OnkeyDown() bit. </dumbass>
whurlston
Offline

Posting Freak

Posts: 7,885
Threads: 102
Joined: Nov 2006
#4
2012-12-14, 07:17 AM
Been there, done that. Big Grin
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Handling simultaneous HTTP requests bgowland 8 3,428 2012-01-29, 12:51 AM
Last Post: bgowland
  NPVR NewStyleButtonListPlugin request whurlston 4 2,088 2010-06-16, 06:49 PM
Last Post: whurlston
  Handling registry redirection in .NET bgowland 2 1,901 2008-11-26, 10:40 AM
Last Post: bgowland
  Unhandled exception handling in GB-PVR ubu 7 2,436 2007-02-18, 02:54 AM
Last Post: sub
  Tricks for handling number keys? (C#) bgowland 1 1,343 2005-11-14, 07:31 PM
Last Post: psycik

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode