Greetings, Monks

I have code simplified as:
$Win=Win32::GUI::Window->new( <blah>); $tv=$Win->AddTreeView( -onClick=> \&onClick_TreeView, -onDblClick => \&onDblClick_TreeView, -onRightClick => \&onRightClick, <blah> );

The problem is that Windows, being what it is, always calls the single click function.
According to Microsoft*, the single-click callback must wait 'DoubleClickTimeout' to see if the double-click callback set a global variable

Ok...
Tests show that if onClick_TreeView returns immediately, the onDblClick_TreeView gets called.

But
If I make onClick_TreeView wait 'DoubleClickTimeout' ms for that global variable, the Double-Click callback never happens.
Pretty sure its because it's all single-threaded.

Is there a clean solution?
Ideally I'd like to have just missed a -DontBeAnArseAboutDblClick common property,
But failing that, any best practice or common workarounds?
The solution recommended by Microsoft is to have the single-click callback set a timer to wait for a 2nd click, or honour the single
Isn't that the OS's JOB?

Anyway,
Thanks.

* https://docs.microsoft.com/en-us/dotnet/desktop/winforms/input-mouse/how-to-distinguish-between-clicks-and-double-clicks?view=netdesktop-5.0

In reply to Win32::GUI ; Click and DoubleClick by The_Dj

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.