Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / August 2006

Tip: Looking for answers? Try searching our database.

message queue

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cnickl - 13 Aug 2006 21:39 GMT
Hi

Here is my problem:

I have a control that does one thing when it is clicked and something else
when it is double clicked. However the click event is always fired before the
double click event. Is there any way I can look at the message queue for this
control and determine if the next message is a double click and therefore
disregard the click event?
Jared - 14 Aug 2006 07:15 GMT
I think best thing to do is to use right click instead of double click...

> Hi
>
[quoted text clipped - 7 lines]
> control and determine if the next message is a double click and therefore
> disregard the click event?
Cyril Gupta - 15 Aug 2006 04:48 GMT
Hello Jared,

Hmm... I think what you are trying to do is not process the click event if
you see a double click event... Is that right?

Well, I don't really see any easy way to do that, but here's a roundabout,
sorta, potty, really inelegant hack

Use a timer in the click event... and disable it in the doubleclick event

In your timer write your trigger code.

That shoulda work for you.

It's just 'magination

Regards
Cyril Gupta

You can do anything with a little bit of 'magination.
http://www.cyrilgupta.com/blog

> I think best thing to do is to use right click instead of double
> click...
[quoted text clipped - 14 lines]
>> therefore
>> disregard the click event?
Larry Lard - 14 Aug 2006 11:44 GMT
> Hi
>
> Here is my problem:
>
> I have a control that does one thing when it is clicked and something else
> when it is double clicked.

Change this. This is utterly confusing and non-intuitive.

Unless you mean something like, for example, a listbox dialog that
selects on click and OKs the dialog on double click. This is natural and
expected.

Signature

Larry Lard
larrylard@googlemail.com
The address is real, but unread - please reply to the group
For VB and C# questions - tell us which version

cnickl - 14 Aug 2006 14:15 GMT
> > Hi
> >
[quoted text clipped - 8 lines]
> selects on click and OKs the dialog on double click. This is natural and
> expected.

Ok, in more detail:

I have a DataGridView with rows of data. When I click once on a row the row
will become selected. When I click once on an already selected cell the
DataGridViewCell goes into edit mode. When I double click anywhere on the row
the program executes a subroutine with the data from that row. It works fine
except when ever I double click an already selected row, the cell goes into
edit mode before executing the subroutine. That’s because the click event is
fired before the DoubleClick event. I guess a solution would be to check for
a DoubleClick event in the Click Event handler and if there is a one, don’t
go into edit mode. Right click to edit would work, however I have a context
menu attached to the DataGridView and I don’t like the un-intuitiveness of
that approach. The question is: is there a way to check for the presents of
the DoubleClick message in the queue?
Mini-Tools Timm - 14 Aug 2006 14:39 GMT
> I have a DataGridView with rows of data. When I click once on a row the row
> will become selected. When I click once on an already selected cell the
[quoted text clipped - 8 lines]
> that approach. The question is: is there a way to check for the presents of
> the DoubleClick message in the queue?

No, because when the Click event is generated, the DoubleClick event has not
yet occurred.  

There are two ways to handle this issue:

Option 1:  The preferred way is to ensure that your single/double click
responses are complimentary.  Like in Windows Explorer, a single click
selects an item, a double click launches it.  That way you can monitor and
handle the Click/DoubleClick events individually without worrying about the
other event.

Option 2:  If you definitely do not want your single click response to
execute if the user double-clicks, your only option is to launch a timer
after the first click, wait the double-click time
(SystemInformation.DoubleClickTime), and if a second click does not occur,
your timer will execute the response to the first click.  The downside to
this option is that your program will seem to lag single clicks by about a
half-second while it waits to see if the second click will occur.

Signature

Timm Martin
Mini-Tools
.NET Components and Windows Software
http://www.mini-tools.com

cnickl - 14 Aug 2006 14:58 GMT
Thanks, this was very helpfull. i guess i have to rethink the way i handle
the events.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.