Ok, thanks, and how can I enable those button events?I don't know what things like ControlStyles..::.StandardDoubleClick mean... it looks like a C++ notation, not C#.
Thanks. Octavian----- Original Message ----- From: "Ken Perry" <whistler@xxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx> Sent: Monday, December 24, 2007 1:57 AM Subject: RE: click event in .net
I think the problem your running into is explained in these two lines of themsdn documents on DoubleClick: By default, the ControlStyles..::.StandardClick and ControlStyles..::.StandardDoubleClick style bits are set to false for the Button control, and the DoubleClick event is not raised. Ken -----Original Message----- From: programmingblind-bounce@xxxxxxxxxxxxx[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Octavian RasnitaSent: Sunday, December 23, 2007 1:18 PM To: programmingblind@xxxxxxxxxxxxx Subject: Re: click event in .net Well, it doesn't happend that way. (That's why I was asking on the list about this issue). I have set the Click and DoubleClick events and 2 handlers for them, but only the Click event is fired right after I pressed the mouse button.I have tried with the num pad slash and with the real mouse button, but onlythe click event is fired. And it is strange, because the Click event in fact is not a OnClick event, but rather an OnMouseDown event. It is fired right after the mouse button was pressed, and not after the mouse button was released for finishing the click. In this situation, of course the program doesn't know that it won't be a click event but a double click. Here is the test program below. If I use a button, the click is fired, but the double click is not. But if I use a label instead, both events are fired. using System; using System.Windows.Forms; class MyForm : Form { public MyForm() { this.Text = "Test form"; Button button = new Button(); button.Text = "Ok";button.Click += delegate(Object sender, EventArgs e) { this.Text = "Click isok"; }; button.DoubleClick += delegate(Object sender, EventArgs e) { MessageBox.Show("the double click is working."); }; this.Controls.Add(button); /* Label label = new Label(); label.Text = "The label";label.Click += delegate(Object sender, EventArgs e) { this.Text = "The clickis ok"; }; label.DoubleClick += delegate(Object sender, EventArgs e) { MessageBox.Show("The double click is working."); }; this.Controls.Add(label); */ } } class Test { static void Main() { Form form = new MyForm(); Application.Run(form); } } Octavian ----- Original Message ----- From: "Jamal Mazrui" <empower@xxxxxxxxx> To: <programmingblind@xxxxxxxxxxxxx> Sent: Sunday, December 23, 2007 9:07 PM Subject: Re: click event in .netMaybe we are just saying it differently -- I think a .NET control can handle both events, but the click event will fire twice, once on its own and once when the double click event fires. Jamal On Sun, 23 Dec 2007, Octavian Rasnita wrote:Date: Sun, 23 Dec 2007 10:35:58 +0200 From: Octavian Rasnita <orasnita@xxxxxxxxx> Reply-To: programmingblind@xxxxxxxxxxxxx To: programmingblind@xxxxxxxxxxxxx Subject: Re: click event in .net Ok, thanks. So it seems that a control in a .net application cannot handle both the click and the doubleClick events. However I think that this is not true for all the controls... I am thinking that a list box should accept the click event and also accept the double click event... Octavian ----- Original Message ----- From: "Jamal Mazrui" <empower@xxxxxxxxx> To: <programmingblind@xxxxxxxxxxxxx> Sent: Sunday, December 23, 2007 4:18 AM Subject: Re: click event in .net > According to the documentation at the page > > "Control.DoubleClick Event (System.Windows.Forms)" >http://msdn2.microsoft.com/en-us/library/system.windows.forms.control.double click.aspx> > a double click event can be handled by a WinForm control, but a click > event will also be handled at that time. If you do not want the click > event to be handled as well, you may have to override its default > handler. > > Hope this helps, > Jamal > > On Sun, > 23 Dec 2007, Octavian Rasnita > wrote: > >> Date: Sun, 23 Dec 2007 00:45:23 +0200 >> From: Octavian Rasnita <orasnita@xxxxxxxxx> >> Reply-To: programmingblind@xxxxxxxxxxxxx >> To: programmingblind@xxxxxxxxxxxxx >> Subject: Re: click event in .net >> >> Ok, thanks, it is not a big problem anyway. >> But I think it could be helpful if you could show us how can this be >> done >> in >> VS.net 2008. >> >> >> Octavian >> >> ----- Original Message ----- >> From: "Eunice Klicker" <cattleya@xxxxxxxxxxxxxx> >> To: <programmingblind@xxxxxxxxxxxxx> >> Sent: Saturday, December 22, 2007 11:41 PM >> Subject: Re: click event in .net >> >>>> > Ok, I might have to eat my words here...What version of .Net are >> > you>> > using? I just took a cursory look for it in my 2008 version, and >> > couldn't >> > find it, and to look in 2005 I'll have to install it, but I'm >> > willing >> > to>> > if that is the version your using. Besides, never know when it >> > will>> > come >> > in handy, and was going to anyways, but if your using 2005 it will >> > force >> > me to quit procrastinating. LOL. Anyways, what I meant by eating >> > my >> > words is this. I should have said, I think it's possible. I think >> > I >> > remember seeing how to do it, but I'm not absolutely positive as I >> > don't >> > have VS2005 open in front of me and I'll take a better look around >> > 2008. >> > >> > ----- Original Message ----- >> > From: "Octavian Rasnita" <orasnita@xxxxxxxxx> >> > To: <programmingblind@xxxxxxxxxxxxx> >> > Sent: Saturday, December 22, 2007 12:48 PM >> > Subject: Re: click event in .net >> > >> > >> >> Oh yes, please tell me how, if it is possible. >> >> >> >> Thank you. >> >> >> >> Octavian >> >> >> >> ----- Original Message ----- >> >> From: "Eunice Klicker" <cattleya@xxxxxxxxxxxxxx> >> >> To: <programmingblind@xxxxxxxxxxxxx> >> >> Sent: Saturday, December 22, 2007 7:37 PM >> >> Subject: Re: click event in .net >> >> >> >>>> >>> Yes, I've seen how it can be done, and if you need help getting >> >>> it>> >>> I'll >> >>> be glad to. >> >>> >> >>> ----- Original Message ----- >> >>> From: "Octavian Rasnita" <orasnita@xxxxxxxxx> >> >>> To: <programmingblind@xxxxxxxxxxxxx> >> >>> Sent: Saturday, December 22, 2007 11:28 AM >> >>> Subject: click event in .net >> >>> >> >>> >> >>>> Hi, >> >>>> >> >>>> I've seen that the Click event for a button in .net (C#) is >> >>>> actually >> >>>> an >> >>>> OnMouseDown event, because if I press the mouse button on a >> >>>> button >> >>>> in a >> >>>> .net app, the event is fired immediately, before allowing me to >> >>>> depress >> >>>> the mouse button. >> >>>> >> >>>> In this case, is it possible in a .net application to create a >> >>>> button >> >>>> that has 2 events, a Click event, and a DoubleClick event? >> >>>> >> >>>> Thank you. >> >>>> >> >>>> Octavian >> >>>> >> >>>> __________ >> >>>> View the list's information and change your settings at >> >>>> //www.freelists.org/list/programmingblind >> >>>> >> >>>> >> >>> >> >>> >> >>> __________ >> >>> View the list's information and change your settings at >> >>> //www.freelists.org/list/programmingblind >> >>> >> >> >> >> __________ >> >> View the list's information and change your settings at >> >> //www.freelists.org/list/programmingblind >> >> >> >> >> > >> > >> > __________ >> > View the list's information and change your settings at >> > //www.freelists.org/list/programmingblind >> > >> >> __________ >> View the list's information and change your settings at >> //www.freelists.org/list/programmingblind >> > __________ > View the list's information and change your settings at > //www.freelists.org/list/programmingblind > __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind__________ View the list's information and change your settings at //www.freelists.org/list/programmingblind__________ View the list's information and change your settings at //www.freelists.org/list/programmingblind __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind
__________View the list's information and change your settings at //www.freelists.org/list/programmingblind