Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. how to override the priority of an event

how to override the priority of an event

Scheduled Pinned Locked Moved C#
helptutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kalaveer
    wrote on last edited by
    #1

    hi in my application initially one button event occurs due to that it executes some function during that function execution if i press any character on the keyboad my keypress event should execute instead of completing the button pressed event code. how can i do that please help thanks in advance.

    S S 2 Replies Last reply
    0
    • K kalaveer

      hi in my application initially one button event occurs due to that it executes some function during that function execution if i press any character on the keyboad my keypress event should execute instead of completing the button pressed event code. how can i do that please help thanks in advance.

      S Offline
      S Offline
      Seishin
      wrote on last edited by
      #2

      I guess that you have to write control inheriting from the control youre using now and override the KeyPress envent sth like this: protected override void OnKeyPress(....){ if(your stuff){ .... } else base.OnKeyPress(e); }

      life is study!!!

      1 Reply Last reply
      0
      • K kalaveer

        hi in my application initially one button event occurs due to that it executes some function during that function execution if i press any character on the keyboad my keypress event should execute instead of completing the button pressed event code. how can i do that please help thanks in advance.

        S Offline
        S Offline
        S Senthil Kumar
        wrote on last edited by
        #3

        Conceptually, the Windows GUI architecture works by having a message queue containing the list of inputs a window has received and a message pump that pops items off the queue and executes their corresponding handlers one by one. In your case, the keypress event will be put in the queue and won't be processes until the button click handler completes. To get around this, you could delegate the button click handler code to a separate thread. This way, the button click handler returns quickly and the message pump processes your keypress. Of course, you would still need to code the handler of the keypress event and abort logic of the button click handler.

        Regards Senthil [MVP - Visual C#] _____________________________ My Blog | My Articles | My Flickr | WinMacro

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups