Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cancel the mouse down event

Status
Not open for further replies.

Juice05

Programmer
Dec 4, 2001
247
US
Does anyone know how to cancel the mouse down event?
 
for what reason? you could probably take care of it within your code...

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
When you click and hold a mouse button on a control (button, form etc) the mouseDown event is called. As you releash it the mouseUp event is called.

If the mouse{Up and Down} events are on the same control then the mouseClick event is called.

So I did answer you ?!


-bclt
 
>Does anyone know how to cancel the mouse down event?

What are you trying to accomplish?
 
Why don't you use the mousedown and mouseup event ?

In the mousedown you set a switch to True to track the status of the mousedown event. In the mouseup event you can track this switch and execute your code from here.

An alternative might be to use another mouse-event to write your code into.

Hope this helps.
 
Heres the deal. I have a listbox with hundreds of items in it. When the user opens an existing record the associated items are selected within the listbox. What I am trying to do is lock the listbox so that the user doesn't accidently click on the listbox and deselect all of the selected items. The end users want the listbox locked so that the user will have to concouesly "unlock" the listbox before being able to select. My idea was to cancel the click event if a variable called Locked is set to true. The end user would be able to right click on the control and select "Unlock Control", setting the locked variable to false.

Locking the control doesn't work the same way as it used to in VB 6...
 
So set SelectionMode to none !
Then set it o One.

Lock property do not let you resize and move the control on design mode.



-bclt


 
That is a good idea but there are two issues with this approach.

1. I get the error "Cannot call this method when selectionMode is SelectionMode.NONE." when I try to set the selectionmode to None. The break appears at the point of selectionmode change.

2. When the control is locked all of the items in the list appear as "System.Data.DataRowView". When I set the value to MultiExtended my values appear correctly.
 
This just in from the "Kludge" department.

How about a transparent picture box? Add a handler for right clicks to prompt the user for the unlock, then set the width to 0. re-lock it by setting the width to as wide as the list box.

-Rick

----------------------
[banghead]If you're about to post an ASP.Net question,
please don't do it in the VB.Net forum[banghead]

[monkey] I believe in killer coding ninja monkeys.[monkey]
 
I was hoping that I wouldn't have to do something like add a check box to enable and disable the control but it appears that it may be my only option.

Before I do that, does anyone else have any ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top