473,834 Members | 1,811 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Forcing a MouseUp event after MouseDown launches a dialog

I have a form listview and have used the MouseDown event to launch a
modal dialog if a particular cell is clicked.

This works fine but upon closing the dialog I am left with a dotted
rectangle drawn between where the original click was and where I
clicked to close the dialog. Until another mouse click occurs this
rectangle resizes as you move the mouse. I guess this is because the
MouseUp event hasn't fired yet (or fired on the modal dialog).

What is the best way to prevent this, or invoke the MouseUp event once
the dialog has closed.

Jul 9 '07 #1
2 3149
On Mon, 09 Jul 2007 00:56:48 -0700, <ch************ *@gmail.comwrot e:
I have a form listview and have used the MouseDown event to launch a
modal dialog if a particular cell is clicked.

This works fine but upon closing the dialog I am left with a dotted
rectangle drawn between where the original click was and where I
clicked to close the dialog. [...]

What is the best way to prevent this, or invoke the MouseUp event once
the dialog has closed.
The answer is to not invoke the dialog on the MouseDown event. Doing so
is non-standard UI anyway, and creates the situation you're seeing in
which the same user action that would normally be interpreted as
mouse-dragging is being overloaded with the dialog invocation as well.

Instead, use MouseUp for knowing when to show the dialog.

Pete
Jul 9 '07 #2
Peter,

Thanks - worked a treat.

Charlie

On 9 Jul, 18:08, "Peter Duniho" <NpOeStPe...@nn owslpianmk.comw rote:
On Mon, 09 Jul 2007 00:56:48 -0700, <charlieopens.. .@gmail.comwrot e:
I have a form listview and have used the MouseDown event to launch a
modal dialog if a particular cell is clicked.
This works fine but upon closing the dialog I am left with a dotted
rectangle drawn between where the original click was and where I
clicked to close the dialog. [...]
What is the best way to prevent this, or invoke theMouseUpevent once
the dialog has closed.

The answer is to not invoke the dialog on the MouseDown event. Doing so
is non-standard UI anyway, and creates the situation you're seeing in
which the same user action that would normally be interpreted as
mouse-dragging is being overloaded with the dialog invocation as well.

Instead, useMouseUpfor knowing when to show the dialog.

Pete

Jul 9 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1697
by: Jeremy Robertson | last post by:
I'm working on an application that manages large image files (mulit-page ..Tiff's to be exact some 1000+ pages). I've written an user control that displays a number of the images as thumbnails in a scrollable window. The user can select and modify Images from my thumbnail control. I need to let the user re-arrange the images if they are out of order. I need the user to be able to click on a thumbnail or multiple and DRAG them to the...
4
4360
by: Colin McGuire | last post by:
Hi again, thanks everyone for your previous help. But having resolved past problems, I'm moving on to new problems :( This one is a simple winforms application with two buttons, named Button1 and Button2, on it (code below). When I press the mouse button over Button2, and don't release it, in the IDE output window it prints "Button2_MouseDown" only. If I release the mouse button over the button, over the form, or even over ANY other...
4
1955
by: Michael Maes | last post by:
Hi, I have a child-form in an MDI-Application which seems to loose the MouseUp-Event. I grid (for navigation-purpose) appears on many of the child-forms and in (I think) only one this issue occurs. What happens: Private Sub grdNavigation_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles grdNavigation.MouseDown Debug.WriteLine("Down: " & e.Button.ToString) End Sub
1
2799
by: Alan | last post by:
i have a form with a label on it Private Sub Label1_mousedown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseDown ' do stuff End Sub Private Sub Label1_mouseup(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseUp
2
4769
by: dave.wayne | last post by:
In a web page I have a div tag that has a onlick event registered through the event listener. However, that same div tag also has a onmousedown - start a drag and drop script The problem I am having is that once the drag and drop is complete, the mouse button is released and the onclick event is firing. I've tried returning false from the function dealing with the mouse up and cancelling the event with if (e.stopPropagation)...
3
3593
by: Techsatish | last post by:
how to make a mouseup event called only once during a double click event? here double click is made on a tree node in a tree control. I have the code inside mouseup event....in runtime the mouseup is called twice for the mouse double click over the selected tree node. I want mouseup event to be called onece Any ideas?
1
5223
by: JDeats | last post by:
It appears the WinForm MouseDown and MouseUp event handlers are not working properly. In the "bare bones" sample application below, Form1_MouseUp gets called even through the mouse button remains pressed while dragging the Form window to resize it. Can this "problem" be explained as some sort of by-design behavior? If so what is the work around to detecting when a user has completed resizing a Windows Form by way of mouse drag? / ...
12
4042
by: Tom Bean | last post by:
I am trying to display a ContextMenuStrip when a user right-clicks on an item in a ListView and have encountered a something that seems strange to me. When the ListView is initially populated, no items are selected. When the first item is selected by clicking either the left or right button, the SelectedIndexChanged event fires but not the MouseUp event. After the first item is selected and another item clicked on, both the...
2
3148
by: markszlazak | last post by:
In the following script, a control displays (black box) in each table cell once you mouse over the cell. Mouse down on the control to change the mode of the table. Drag the mouse over cells in the same column then mouseup anywhere in a cell. The mouseup event sometimres fires before the selection of table cells by dragging is complete. It's important that I stop these "false" mouseup's from firing or distinguish them from when I let go of...
0
9649
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10799
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10515
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10554
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10224
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7761
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5799
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4428
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3985
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.