Board index » cppbuilder » very simple click and double click question

very simple click and double click question

Hi,

I have a TDrawGrid and I want it to open two differents form if the user
click or double-click on a cell.  As far as my test shown, the OnClick event
is called even for the double-click event, what lead to open the two
forms...

Is there a way to handle these two differents event to make them do what I
want?

Thanks
Michael

P.S. I tried looking at the OnMouseDown event, but it is called afer the
OnClick event???? How is it possible to click without pressing down the
mouse...?

 

Re:very simple click and double click question


In <8kl132$2...@bornews.borland.com>, Michael Grimard wrote:

Quote
> I have a TDrawGrid and I want it to open two differents form if the user
> click or double-click on a cell.  As far as my test shown, the OnClick event
> is called even for the double-click event, what lead to open the two
> forms...
> Is there a way to handle these two differents event to make them do what I
> want?

Here's the answer I gave in another group; perhaps it can apply to you:

================
As usual, the documentation is scanty in the extreme - if not
nonexistent - although Kent Reisdorph (sp?) did have something about
this in his book that accompanied version 3.

How about setting flags (and doing nothing else) in the OnClick and
OnDblClick event handlers... then, in OnMouseUp, consult your double
click flag to see what happened; if it is set, the user double clicked,
otherwise it was just a single click. In either case, you'll know which
function to invoke.
================

        -- AK

--
adam.kip...@pobox.com
PGP keys available from servers

Re:very simple click and double click question


Quote
"Michael Grimard" <micha...@maxt.com> wrote in message

news:8kl132$28k2@bornews.borland.com...

Quote
> I have a TDrawGrid and I want it to open two differents form if the user
> click or double-click on a cell.  As far as my test shown, the OnClick
event
> is called even for the double-click event, what lead to open the two
> forms...

Hi Michael,

Click is also a move between cells with an arrow key.
Double click is strictly a mouse action.

You could start a timer and if the double click doesn't happen within a tick
assume a single click.

alternatives would be to:
1) use the right mouse button to open a popup menu.
2) use OnMouseDown and check for the alt, ctrl, or shift keys for Form1 or
Form2.

I think the submenu is the best idea.

LJ

Other Threads