473,837 Members | 1,623 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 6626
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
3144
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
3734
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
3273
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
4453
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
1429
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
9696
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
10288
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...
0
9420
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
7824
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
7014
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
5680
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5863
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4062
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3128
bsmnconsultancy
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...

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.