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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. How to ignore events?

How to ignore events?

Scheduled Pinned Locked Moved C#
tutorialquestion
5 Posts 4 Posters 1 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.
  • D Offline
    D Offline
    Delegate
    wrote on last edited by
    #1

    I want to ignore the mouse click event means whenever the event fired it just get ignored (nothing happen). For example I have a TextBox but when I click on it nothing happen, it just ignores the click event. I don't want to use the Enabled property cause it changes its apperance. Thanks in advance.

    D M M 3 Replies Last reply
    0
    • D Delegate

      I want to ignore the mouse click event means whenever the event fired it just get ignored (nothing happen). For example I have a TextBox but when I click on it nothing happen, it just ignores the click event. I don't want to use the Enabled property cause it changes its apperance. Thanks in advance.

      D Offline
      D Offline
      David Stone
      wrote on last edited by
      #2

      Just don't write a method that fires when it's clicked...


      You will now find yourself in a wonderous, magical place, filled with talking gnomes, mythical squirrels, and, almost as an afterthought, your bookmarks -Shog9 teaching Mel Feik how to bookmark I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past. -Chris Maunder

      1 Reply Last reply
      0
      • D Delegate

        I want to ignore the mouse click event means whenever the event fired it just get ignored (nothing happen). For example I have a TextBox but when I click on it nothing happen, it just ignores the click event. I don't want to use the Enabled property cause it changes its apperance. Thanks in advance.

        M Offline
        M Offline
        Mark Conger
        wrote on last edited by
        #3

        Usually in a case like this I reate a new class derived fromm the control that I wasnt to modify, then basically override those event methods. Might be the long way to do it.... Mark

        1 Reply Last reply
        0
        • D Delegate

          I want to ignore the mouse click event means whenever the event fired it just get ignored (nothing happen). For example I have a TextBox but when I click on it nothing happen, it just ignores the click event. I don't want to use the Enabled property cause it changes its apperance. Thanks in advance.

          M Offline
          M Offline
          Martin Haesemeyer
          wrote on last edited by
          #4

          Hi! I don't know if this really is a good idea. Because you user expects a visual feedback. If you disable the listbox, let it look disabled and don't fool your user. But if you want to do it, do the following: 1)Derive a class from TextBox 2)Override WndProc. And call the base-class method on all messages except WM_CLICK. This should work. Cheers HTH Martin "Situation normal - all fu***d up" Illuminatus!

          D 1 Reply Last reply
          0
          • M Martin Haesemeyer

            Hi! I don't know if this really is a good idea. Because you user expects a visual feedback. If you disable the listbox, let it look disabled and don't fool your user. But if you want to do it, do the following: 1)Derive a class from TextBox 2)Override WndProc. And call the base-class method on all messages except WM_CLICK. This should work. Cheers HTH Martin "Situation normal - all fu***d up" Illuminatus!

            D Offline
            D Offline
            Delegate
            wrote on last edited by
            #5

            I agree what u said and I tried the way you suggest it works great. But there is a problem it can be a expensive call, cause it goes in WndProc all the time cause events are firing all the time. Is there another way, like just detach that attached event. I will be really thankful to you.

            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