Thanks,
Bob Cohen
I don't think so. It would involve the OS pausing long enough to determine
if a second click is coming. That would result in an annoying delay if you
really did click just once.
Also, some people double click on command buttons and such when first
starting out. By trapping the single click first, they are not hampered.
Thus this behavior is expected.
--
Jonathan Allen
"Robert M. Cohen" <robert...@hotmail.com> wrote in message
news:#u5CFiUkAHA.1320@tkmsftngp04...
Thanks,
Bob Cohen
"Jonathan Allen" <greyw...@bigfoot.com> wrote in message
news:#x1N8RVkAHA.236@tkmsftngp04...
Does it?
MFC docs...
*******
Double-clicking the left mouse button actually generates a sequence of four
messages: WM_LBUTTONDOWN, WM_LBUTTONUP, WM_LBUTTONDBLCLK, and WM_LBUTTONUP.
*******
Since the message sequence (WM_LBUTTONDOWN, WM_LBUTTONUP) triggers a click
event, I don't see how it can. For what you want to occure, you would have
to ignore the first two messages. But the only way to know if it should be
ignored is if you can see into the future and predict the third message,
WM_LBUTTONDBLCLK.
> For instance the recognition delay is
> programmable in the mouse control panel.
All that controls is the max time difference between the first and second
click. It does not provide the magical ability needed to predict a
double-click.
**************************
To acomplish your goal, you would need to follow these steps...
1. Determine the max delay for a Double Click, add 1 unit of time.
2. Sink the Click event and record the time.
3. Start a timer to be triggered at ([1] + [2])
A_4. Sink the DoubleClick Event
A_5. Stop the timmer so that the Click will be ignored
A_6. Handle the DoubleClick Event
B_4. Handle the Click Event. (Since DoubleClick didn't occur in time)
If you do this, you don't have to worry about the Click preceding the
DoubleClick. However you get a delay of [1] to all Click events, which can
be considerable. Intentionally making a program unresponsive is hardly the
way to develope a professional grade application.
**************************
Now that nonsense is settled, lets take a look at your design itself.
Exactly what are you trying to acomplish, and why do you think you need a
Click event that cannot precede a DoubleClick event?
--
Jonathan Allen
"Robert M. Cohen" <robert...@hotmail.com> wrote in message
news:e1ibWFakAHA.2068@tkmsftngp02...
Bob,
The usual way of accomplishing this is to handle the single click,
start a timer for a little longer than the system defined double click
time. If you get a double click event, kill the timer and do your
double click action, if the timer fires, do your single click event.
Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
My address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow-up email copies.
At every level I know of, down to the Petzold style window proc, a double
click will be preceeded by a click. The usual solution is to make the
double click gracefully follow a click. For example in explorer, first
click selects, double click executes. In word, first click sets cursor,
second click selects word. As Jonathan Allen pointed out, if you must
detect double click without handling the preceeding single click, you need
to wait the appropriate amount of time. But your users will probably become
irate that your program doesn't respond to single clicks very quickly...
Ken
What I want to program is the ability to double-click a control on a form
and get a properties window up, but a single click selects the object (i.e.
outlines it).
Thanks,
Bob
"Jonathan Allen" <greyw...@bigfoot.com> wrote in message
news:u8ECFcbkAHA.1568@tkmsftngp04...
In studying this whole thing, however, another issue cropped up: I built a
little applet to show me mousestroke sequences and for a double click I'm
seeing Down/Up/Click/DoubleClick/Down/Up.
That is different from the MFC sequence that Jonathan Allen pointed out to
me (Down/Up/DoubleClick/Up). That creates a problem in that if I do my
dialog at the doubleclick, I get what looks like a phantom mouse down
immediately afterwards. I'm equipped to handle an "unattached" mouse up,
but that next mouse down takes me to places I really don't want to be.
Any ideas on that one???
Thanks,
Bob Cohen
"Ken Alverson" <K...@Alverson.com> wrote in message
news:OQspOpckAHA.2172@tkmsftngp02...
Bob Cohen
"Robert M. Cohen" <robert...@hotmail.com> wrote in message
news:#tZXxAdkAHA.1136@tkmsftngp04...
Bob Cohen
"Robert M. Cohen" <robert...@hotmail.com> wrote in message
news:eZ2T#EdkAHA.2180@tkmsftngp05...
--
Jonathan Allen
"Robert M. Cohen" <robert...@hotmail.com> wrote in message
news:#lQ7POdkAHA.2180@tkmsftngp05...
Unless selecting an object will kill your program, I don't see the problem.
Besides, they probably want the properties of the object they double-clicked
on.
--
Jonathan Allen
"Robert M. Cohen" <robert...@hotmail.com> wrote in message
news:OI$intckAHA.2080@tkmsftngp05...
Bob Cohen
"Jonathan Allen" <greyw...@bigfoot.com> wrote in message
news:#OM8VRhkAHA.1664@tkmsftngp03...
Juan Galvez
"Ken Alverson" <K...@Alverson.com> wrote in message
news:OQspOpckAHA.2172@tkmsftngp02...
Thanks,
Bob Cohen
"me" <juan_...@hotmail.com> wrote in message
news:OsO$3TykAHA.2156@tkmsftngp05...
Actually, Windows Explorer distinguishes between the two. If something is
selected, and you single-click on it, it waits for a fraction of a second
(waiting for a double-click) and then edits the name of the item. If you
happen to double-click, it opens the item.
Whether or not this is a good design is, of course, questionable, but there
certainly exists a precedent. Having actually read the design requirement of
the current problem at hand, though, I think that the double-click case
should logically also call the single-click case.
Peter
--
Peter Torr - pt...@microsoft.com
JScript .NET / VSA Runtime Program Manager
Please post all questions to the group. Thanks.
However, I have also bugged what I consider a problem in that the
double-click returns the following sequence:
Down/Up/Double-Click/Down/Up.
That second down is different than the MFC version (Down/Up/Double-Click/Up)
and leads to a "spurious" keystroke after the double-click. For instance if
I want to do a properties dialog on an object via a double-click, then the
first thing that happens when the dialog is done is to get another click.
This following click really isn't there and really isn't what the user
intended.
Bob Cohen
"Peter Torr (MS)" <pt...@microsoft.com> wrote in message
news:#QBtd28kAHA.1316@tkmsftngp03...
Good point. Do you know if it does that with a message from the OS or just a
timer?
--
Jonathan Allen