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. Handle MouseWheel Without giving control Focus?

Handle MouseWheel Without giving control Focus?

Scheduled Pinned Locked Moved C#
question
4 Posts 2 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.
  • S Offline
    S Offline
    Sukhjinder_K
    wrote on last edited by
    #1

    I have a Custom Control Listbox L1 and a panel P1. I need to handle Mouse Wheel movement on Panel P1 without giving it focus. I cannot use MouseWheel Event as it fires ONLY when the underlying control has focus. Any suggestions? Sukhjinder

    C 1 Reply Last reply
    0
    • S Sukhjinder_K

      I have a Custom Control Listbox L1 and a panel P1. I need to handle Mouse Wheel movement on Panel P1 without giving it focus. I cannot use MouseWheel Event as it fires ONLY when the underlying control has focus. Any suggestions? Sukhjinder

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      I guess you need to catch the event where you have focus and pass it to your control.

      Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      S 1 Reply Last reply
      0
      • C Christian Graus

        I guess you need to catch the event where you have focus and pass it to your control.

        Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        S Offline
        S Offline
        Sukhjinder_K
        wrote on last edited by
        #3

        Hi, One of my controls is a Custom ListBox L1 which handles MouseWheel Events for itself so I cannot intercept its mouse wheel events and use it. Also this does not look & feel elegant. Also I have few Push Buttons and I dont want to handle their mouse wheel events...

        C 1 Reply Last reply
        0
        • S Sukhjinder_K

          Hi, One of my controls is a Custom ListBox L1 which handles MouseWheel Events for itself so I cannot intercept its mouse wheel events and use it. Also this does not look & feel elegant. Also I have few Push Buttons and I dont want to handle their mouse wheel events...

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Well, if mouse wheel events only get sent to the control that has the focus ( as all mouse events do ), the only other solution I can think of is if there's an API you can call to get the wheel pos, on a timer. That's not elegant, it's ugly. And, I don't think it works, from memory, the mouse wheel events pass a number that tells you the direction the mouse moved in and how fast, not a number that defines a finite position.

          Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

          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