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 1440
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******@bresna n.net
"Bob" <no****@nowhere .com> wrote in message
news:Oa******** ********@TK2MSF TNGP09.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******** ******@TK2MSFTN GP12.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******@bresna n.net "Bob" <no****@nowhere .com> wrote in message news:Oa******** ********@TK2MSF TNGP09.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 DoubleClickTime r As Timer
Public Sub New()
DoubleClickTime r = New Timer
DoubleClickTime r.Interval = 500
Me.ContextMenu = New ContextMenu
Me.ContextMenu. MenuItems.Add(" something")
End Sub
Protected Overrides Sub OnMouseDown(ByV al e As
System.Windows. Forms.MouseEven tArgs)
If ReadyForDoubleC lick Then
Me.OnDoubleClic k(e)
Else
Me.ContextMenu. Show(Me, New Point(e.X, e.Y + 10))
End If
MyBase.OnMouseD own(e)
End Sub
Protected Overrides Sub OnDoubleClick(B yVal e As System.EventArg s)
ReadyForDoubleC lick = False
MsgBox("test")
MyBase.OnDouble Click(e)
End Sub
Private Property ReadyForDoubleC lick() As Boolean
Get
Return Not timerticked
End Get
Set(ByVal Value As Boolean)
timerticked = Not Value
DoubleClickTime r.Enabled = Value
End Set
End Property
Private timerticked As Boolean = True
Private Sub DoubleClickTime r_Tick(ByVal sender As Object, ByVal e As
System.EventArg s) _
Handles DoubleClickTime r.Tick
ReadyForDoubleC lick = False
End Sub
Protected Overrides Sub WndProc(ByRef m As System.Windows. Forms.Message)
Select Case m.Msg
Case 279 'context menu popup
Me.OnContextMen uPopup(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
ReadyForDoubleC lick = False
Case 530 'exit context menu popup
Me.OnContextMen uExit(New EventArgs)
End Select
MyBase.WndProc( m)
End Sub
Private _DoingContextMe nu As Boolean
Protected Overridable ReadOnly Property DoingContextMen u() As Boolean
Get
Return _DoingContextMe nu
End Get
End Property
Protected Overridable Sub OnContextMenuPo pup(ByVal e As EventArgs)
_DoingContextMe nu = True
ReadyForDoubleC lick = True
End Sub
Protected Overridable Sub OnContextMenuEx it(ByVal e As EventArgs)
_DoingContextMe nu = False
If ReadyForDoubleC lick Then
ReadyForDoubleC lick = False
If Me.ContainsCurs or Then Me.OnDoubleClic k(e)
End If
End Sub
Protected ReadOnly Property ContainsCursor( ) As Boolean
Get
Return
Me.ClientRectan gle.Contains(Me .PointToClient( Me.Cursor.Posit ion))
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 possible or not?
thanks a lot!
|
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 doubleclick to display ads on our
site but what i don't understand is how would this affect the site from
being accessable?
thanks
|
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 do I use javascript to run a server
side function? Currently, I am using a Next button to accept the change, but
it would be a faster UI to have the option to doubleclick instead.
thanks a ton!
david lozzi
|
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 selectedindexchanged and click events.
It does not make any difference whether I use Simple, drop down or drop down
list in the DropDownStyle property.
Private Sub ComboBox1_DoubleClick(ByVal sender As Object, ByVal e As
| |
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 IntellSense gives it as an option for both??
Any enlighten comments?
|
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 button for drag I do not get a DoubleClick event with
the Left Button.
I'd guess that's the way it is but am wondering if there is a way that I
|
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 column or row header. How is it possible to get a
DoubleClick event to occur on a row wherever it is DoubleClick. I also want,
when a cell within the row is selected, that the entire row is marked as
selected not just the actual cell.
TIRislaa
|
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 double-click event on some
SSOption buttons and would like to duplicate this behaviour (for existing
users) in the vb.NET version. Using the cursor arrows to navigate through
radiobuttons contained in a groupbox inititates the click event for 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 outside the data.
The trouble is, the underlying cells or columns or whatever would like
to have something to say about this. The cells respond to the
DoubleClick but not the grid.
How do I get my event handler to handle all double clicks...
|
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...
| |
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...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |