473,804 Members | 3,191 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RadioButton doubleclick event...where did it go?

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
respective radiobutton whenever it receives the focus. In the VB4 version of
my application, using the cursor keys would select the appropriate
radiobutton, whilst pressing the Enter key when a radiobutton was selected
would cause the coding to select the appropriate routine (thus a user could
operate all aspects of the application using the keyboard only): if the mouse
was used instead, then double clicking the respective radiobutton would have
the same effect as the keyboard-only method.
The vb.NET on-line help mentions a RadioButton.Dou bleClick event but
crypticly (to me at any rate) saying:
<<This member supports the .NET Framework infrastructure but is not intended
to be used directly from your code.
Public Shadows Event DoubleClick As Eventhandler >>
Erm, what does this mean? I guess it means that I can create an event
handler but I have no idea how to do this. Could some kind person provide
show me how it could be done? Many thanks in advance.
Nov 21 '05 #1
3 6624
I ran into this same problem, Googled, and found your post. After
digging around a bit using Reflector, I discovered that in the .NET
Framework 1.1, StandardClick is turned off for the RadioButton, and
therefore StandardDoubleC lick is also off. They went out of their way
to make sure double-click is dead by clobbering the base class's
DoubleClick event with the "new" keyword in C# (the Shadows keyword in
VB.NET), and tacking on two attributes that ensure you can't find the
DoubleClick event in the designer or with Intellisense:
EditorBrowsable (EditorBrowsabl eState.Never) and Browsable(false ).
Apparently they weren't aware that this is actually a useful feature:
http://blogs.msdn.com/oldnewthing/ar...04/447654.aspx

It appears the .NET Framework 2.0 fixes this by adding a
RadioButton.Mou seDoubleClick event, but for those of us "unfortunat e"
enough to be developing products on pre-2.0, we're on our own.

I came up with a solution to this in C#. Put the following code in the
form that contains the radio buttons and hook up all your RadioButtons'
Click events to radioButton_Cli ck.

DateTime _lastClick = DateTime.MinVal ue;
object _lastControl = null;

private void radioButton_Cli ck(object sender, EventArgs e)
{
// simulate a double-click since RadioButton disables it
DateTime clickTime = DateTime.Now;
if(_lastControl == sender)
{
TimeSpan ts = clickTime - _lastClick;
if(ts.TotalMill iseconds <= (double)SystemI nformation.Doub leClickTime)
DoYourDoubleCli ckStuffHere();
}
_lastClick = clickTime;
_lastControl = sender;

// normal Click event stuff can go here
}

Hope this helps! Sorry it's not VB, but you should have no problem
porting it.

Oran

Nov 21 '05 #2
I ran into this same problem, Googled, and found your post. After
digging around a bit using Reflector, I discovered that in the .NET
Framework 1.1, StandardClick is turned off for the RadioButton, and
therefore StandardDoubleC lick is also off. They went out of their way
to make sure double-click is dead by clobbering the base class's
DoubleClick event with the "new" keyword in C# (the Shadows keyword in
VB.NET), and tacking on two attributes that ensure you can't find the
DoubleClick event in the designer or with Intellisense:
EditorBrowsable (EditorBrowsabl eState.Never) and Browsable(false ).
Apparently they weren't aware that this is actually a useful feature:
http://blogs.msdn.com/oldnewthing/ar...04/447654.aspx

It appears the .NET Framework 2.0 fixes this by adding a
RadioButton.Mou seDoubleClick event, but for those of us "unfortunat e"
enough to be developing products on pre-2.0, we're on our own.

I came up with a solution to this in C#. Put the following code in the
form that contains the radio buttons and hook up all your RadioButtons'
Click events to radioButton_Cli ck.

DateTime _lastClick = DateTime.MinVal ue;
object _lastControl = null;

private void radioButton_Cli ck(object sender, EventArgs e)
{
// simulate a double-click since RadioButton disables it
DateTime clickTime = DateTime.Now;
if(_lastControl == sender)
{
TimeSpan ts = clickTime - _lastClick;
if(ts.TotalMill iseconds <= (double)SystemI nformation.Doub leClickTime)
DoYourDoubleCli ckStuffHere();
}
_lastClick = clickTime;
_lastControl = sender;

// normal Click event stuff can go here
}

Hope this helps! Sorry it's not VB, but you should have no problem
porting it.

Oran

Nov 21 '05 #3
Thanks for your comments: when I get some time I'll try 'porting' your code.
"od*******@gmai l.com" wrote:
I ran into this same problem, Googled, and found your post. After
digging around a bit using Reflector, I discovered that in the .NET
Framework 1.1, StandardClick is turned off for the RadioButton, and
therefore StandardDoubleC lick is also off. They went out of their way
to make sure double-click is dead by clobbering the base class's
DoubleClick event with the "new" keyword in C# (the Shadows keyword in
VB.NET), and tacking on two attributes that ensure you can't find the
DoubleClick event in the designer or with Intellisense:
EditorBrowsable (EditorBrowsabl eState.Never) and Browsable(false ).
Apparently they weren't aware that this is actually a useful feature:
http://blogs.msdn.com/oldnewthing/ar...04/447654.aspx

It appears the .NET Framework 2.0 fixes this by adding a
RadioButton.Mou seDoubleClick event, but for those of us "unfortunat e"
enough to be developing products on pre-2.0, we're on our own.

I came up with a solution to this in C#. Put the following code in the
form that contains the radio buttons and hook up all your RadioButtons'
Click events to radioButton_Cli ck.

DateTime _lastClick = DateTime.MinVal ue;
object _lastControl = null;

private void radioButton_Cli ck(object sender, EventArgs e)
{
// simulate a double-click since RadioButton disables it
DateTime clickTime = DateTime.Now;
if(_lastControl == sender)
{
TimeSpan ts = clickTime - _lastClick;
if(ts.TotalMill iseconds <= (double)SystemI nformation.Doub leClickTime)
DoYourDoubleCli ckStuffHere();
}
_lastClick = clickTime;
_lastControl = sender;

// normal Click event stuff can go here
}

Hope this helps! Sorry it's not VB, but you should have no problem
porting it.

Oran

Nov 21 '05 #4

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

Similar topics

2
506
by: cmelnick | last post by:
I need to determine whether the user used the right or left mouse button to click an element on a form. AFAIK, there is no way to determine this from the Click (or DoubleClick) event. I currently have my form set up to have a MouseButtons instance that gets updated by the MouseDown event, then the Click event checks the instance to see if it was right or left. This works fine, but seems a very roundabout and clumsy way to do something...
5
3142
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
1
4106
by: Buddy Ackerman | last post by:
Why is there no DoubleClick event on the ListBox control? I set a dual list box interface and want to be able to allow the user to double-click an item in one listbox to move it to the other. I have buttons that do that now but I would like for the DoubleClick to be a shortcut. I'm posting this becasue I can't believe that no DoubleClick event exists, there must be a way to get this to work. --Buddy
1
3731
by: Duke | last post by:
Trying to learn vb.net & am frustrated. I've got data in a grid. Want user to be able to double- click on a row and see a new form with additional detail for that row. Works fine, so long as user doubleclicks on the grid's row selector along the left border. How do I trap this if the user doubleclicks on a cell in
4
3272
by: _DD | last post by:
TrackBar DoubleClick event is not accessible via the Control Properties event pane. So I tried adding the handler directly: this.ColTrackBar.DoubleClick += new System.EventHandler(this.ColTrackBar_DoubleClick); It compiles but never fires. I suspect that individual Click events are getting gobbled up by the main trackbar position event handler. Any way around this?
0
1401
by: dr | last post by:
how to intercept the doubleclick event on a .net 2.0 webbrowser control?
1
4450
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, I've panel in my windows form, and i want to get the exact mouse position when i double click. I used: Point p = this.panel1.PointToClient(Cursor.Position); but now, if i'm pointing on the top-left corner of the panel i get the cordinates (0,0), and then, i'm scrolling with the mouse whell, and then i double click again, on the same corner and i get the same result.
1
1426
by: Dom | last post by:
has anyone else noticed that the DoubleClick event on the DataGridView control (and maybe other controls too) is way too sensitive. The event is triggered when I perform what I think of as two single clicks. It is not a matter of fine-tuning the mouse itself. Amy I doing something wrong? Dom
0
1545
by: Emma Middlebrook | last post by:
Hi there, I'm having problems in an ASP.NET page that is dynamically creating and displaying radio buttons. I have setup a checkchanged event and specified AutoPostBack to true. When the page loads none of the radio buttons are checked by default. When the user checks the first one, the page refreshes but the checkchanged event never triggers. If you then select a different radio button, the postback occurs but the event also triggers.
0
9707
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9585
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
10586
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...
1
10323
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
9161
agi2029
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...
1
7622
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
6856
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();...
0
5658
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4301
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 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.