How do I mark a mouse click as handled?

  • Thread starter Thread starter konafreeride
  • Start date Start date
K

konafreeride

Hello,

Does anyone know of how I can go about suppressing a mouse click after
I've handled it? I know this can be done for keystrokes via the
Handled property, but I am unable to find a way to do so for mouse
events.
 
Hi,

IIRC there is no equivalent. The way of doing it is by deriving the control
you want, overwrite onMouseDown and not calling the base method
 
Hello,

Does anyone know of how I can go about suppressing a mouse click after
I've handled it? I know this can be done for keystrokes via the
Handled property, but I am unable to find a way to do so for mouse
events.

try this

protected override void WndProc(ref System.Windows.Forms.Message m)
{
if (m.Msg == 0x202) /* WM_LBUTTONUP */
{
// Handle the mouse Event here

m.Result = new IntPtr(1); // Sucessful
return; //eat up the message
}
base.WndProc(ref m);
}

override the WndProc function of the control whose click you want to
supress (by overriding that control)

Alternatively capture the WM_NOTIFY message and check if its left
button click and if its on the control that you want to handle.

But is a little bit complex and I dont remember right now how exactly
to do this.
code goes something like this.
if(m.Msg == WM_NOTIFY)
{
NMHEADER = get this thing from m.LParam

then the NMHEADER structure has all the information required to know
what type of notification message is it and which control is it meant
for.
}

for a list on the constant values for the Windows Messages refer this
link
http://www.autohotkey.com/docs/misc/SendMessageList.htm

Searching on google might help.

Sorry for the incomplete solution.
 
Hi,



You have to derive the control anyway, if you do so is better to just
override the onMouseDown method.
 
Ignacio said:
Hi,




You have to derive the control anyway, if you do so is better to just
override the onMouseDown method.
Unless the processing is done outside of the control, e.g. when the
source code for it is not available. Then you have to go the WndProc way
(I think).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top