Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Win32::GUI ; Click and DoubleClick

by The_Dj (Sexton)
on Jul 02, 2021 at 04:39 UTC ( #11134580=perlquestion: print w/replies, xml ) Need Help??

The_Dj has asked for the wisdom of the Perl Monks concerning the following question:

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

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

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?



Replies are listed 'Best First'.
Re: Win32::GUI ; Click and DoubleClick
by Anonymous Monk on Jul 02, 2021 at 10:14 UTC
      A Perfectly workiing sample, with some other tricks I can use. 😄

      Thanks Much!(I always just read the site\lib\Win32\GUI\demos\* directly. Never bothered looking for the launcher.)

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11134580]
Approved by marto
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2023-05-30 20:39 GMT
Find Nodes?
    Voting Booth?

    No recent polls found