My control pops a menu (below, not directly under, the pointer) OnMouseDown,
and, probably because of the loss of focus, OnDoubleClick doesn't fire any
more. Is there a way to get doubleclick back without some ugly workaround?
TIA,
Bob 3 1424
Why don't you fix it so that the MouseDown only pops the menu on a right
click? That will allow a left double click to trigger the other event you
desire.
Will that work for you?
--
Marc Butenko mb******@bresnan.net
"Bob" <no****@nowhere.com> wrote in message
news:Oa****************@TK2MSFTNGP09.phx.gbl... My control pops a menu (below, not directly under, the pointer)
OnMouseDown, and, probably because of the loss of focus, OnDoubleClick doesn't fire any more. Is there a way to get doubleclick back without some ugly workaround?
TIA, Bob
No, that's not acceptable. This is a button that must function like the menu
icon at the top left-hand corner of a windows form. You left-click it, you
get a menu. You double left-click it, it closes the form.
Bob
"Marc Butenko" <mb******@state.mt.us> wrote in message
news:eO**************@TK2MSFTNGP12.phx.gbl... Why don't you fix it so that the MouseDown only pops the menu on a right click? That will allow a left double click to trigger the other event you desire.
Will that work for you?
-- Marc Butenko mb******@bresnan.net "Bob" <no****@nowhere.com> wrote in message news:Oa****************@TK2MSFTNGP09.phx.gbl... My control pops a menu (below, not directly under, the pointer) OnMouseDown, and, probably because of the loss of focus, OnDoubleClick doesn't fire
any more. Is there a way to get doubleclick back without some ugly
workaround? TIA, Bob
Well I got something reasonable working...
Bob
------
Public Class UserControl1
Inherits System.Windows.Forms.Control
Private WithEvents DoubleClickTimer As Timer
Public Sub New()
DoubleClickTimer = New Timer
DoubleClickTimer.Interval = 500
Me.ContextMenu = New ContextMenu
Me.ContextMenu.MenuItems.Add("something")
End Sub
Protected Overrides Sub OnMouseDown(ByVal e As
System.Windows.Forms.MouseEventArgs)
If ReadyForDoubleClick Then
Me.OnDoubleClick(e)
Else
Me.ContextMenu.Show(Me, New Point(e.X, e.Y + 10))
End If
MyBase.OnMouseDown(e)
End Sub
Protected Overrides Sub OnDoubleClick(ByVal e As System.EventArgs)
ReadyForDoubleClick = False
MsgBox("test")
MyBase.OnDoubleClick(e)
End Sub
Private Property ReadyForDoubleClick() As Boolean
Get
Return Not timerticked
End Get
Set(ByVal Value As Boolean)
timerticked = Not Value
DoubleClickTimer.Enabled = Value
End Set
End Property
Private timerticked As Boolean = True
Private Sub DoubleClickTimer_Tick(ByVal sender As Object, ByVal e As
System.EventArgs) _
Handles DoubleClickTimer.Tick
ReadyForDoubleClick = False
End Sub
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
Select Case m.Msg
Case 279 'context menu popup
Me.OnContextMenuPopup(New EventArgs)
Case 287 'menu select
'if the user really selected a menu item, LParam will
contain a value
If Not m.LParam.Equals(System.IntPtr.Zero) Then
ReadyForDoubleClick = False
Case 530 'exit context menu popup
Me.OnContextMenuExit(New EventArgs)
End Select
MyBase.WndProc(m)
End Sub
Private _DoingContextMenu As Boolean
Protected Overridable ReadOnly Property DoingContextMenu() As Boolean
Get
Return _DoingContextMenu
End Get
End Property
Protected Overridable Sub OnContextMenuPopup(ByVal e As EventArgs)
_DoingContextMenu = True
ReadyForDoubleClick = True
End Sub
Protected Overridable Sub OnContextMenuExit(ByVal e As EventArgs)
_DoingContextMenu = False
If ReadyForDoubleClick Then
ReadyForDoubleClick = False
If Me.ContainsCursor Then Me.OnDoubleClick(e)
End If
End Sub
Protected ReadOnly Property ContainsCursor() As Boolean
Get
Return
Me.ClientRectangle.Contains(Me.PointToClient(Me.Cu rsor.Position))
End Get
End Property
End Class This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: DraguVaso |
last post by:
Hi,
When you double click on a form in the Solution Explorer, it will show that
form in the Designe Mode. Is there a way to change this, so it will switcvh
to the 'Code Mode'?
Is this...
|
by: tin |
last post by:
some of our visitors have complaint to us that our site is inaccessible when
they have software that blocked doubleclick.net ads or their ISP blocking
*.doubleclick.net site. Yes, we do use...
|
by: Hylton |
last post by:
Hi
In a treeview How do I get the node that the user right clicked on. I need
to modify the contecxt menu based on the node
|
by: David Lozzi |
last post by:
Hey All,
I have a listbox that I would like to fire an event on doubleclick. the
onDoubleClick property of the listbox isnt available be default, and I know
it will work with Javascript, but how...
|
by: Jan Nielsen |
last post by:
Hi
I have a form with some comboboxes
My problem is that they don't react on my doubleclick event.
I doubleclick in the textbox part of the combo. And nothing happens.
They react on...
|
by: active |
last post by:
DoubleClick seems to work OK with a ListBox.
However, with a ListView I never get the event fired.
I looked at both the LIstBox and ListView events and neither
lists the DoubleClick???
But...
|
by: active |
last post by:
I'm about ready to give up unless someone has an idea.
Trying to do in a ListView DragDrop and DoubleClick.
I can make it work if they use different mouse buttons.
But if I use the left...
|
by: Tor Inge Rislaa |
last post by:
DoubleClick in DataGrid
Hi I have a Datagrid bound to a dataset that I want to write a DoubleClick
procedure on. My problem is that the DoubleClick event is raised only when
DoubleClicking the...
|
by: LCAdeveloper |
last post by:
Help! A trawl through the archives couldn't shed any light on this, so is
there a way to handle DoubleClick events for RadioButtons in vb.NET? I'm
recoding a VB4 application, which used the...
|
by: C Glenn |
last post by:
I would like one DoubleClick event handler to handle all double clicks
throughout a DataGrid. I've assigned a DoubleClick event handler to the
DataGrid and it works nifty-spiffy so long as I click...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |