FYI - OnMouseDown Takes Priority Over OnClick

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

FYI - OnMouseDown Takes Priority Over OnClick

Post by JRL » Mon Jun 24, 2013 2:41 pm

I have a script in which I have several AddDialogHandler> lines. I thought last week that I had everything working but this morning I discovered a subroutine based on a dialog click was not working. Perusing the code I eventually found I had a dialog handler line for "OnClick" on Dialog1 and a dialog handler line for "OnMouseDown" on Dialog1. I created the following script to see how they interplay and found that no matter how I arrange the code, OnMouseDown always outranks OnClick. If you have both lines the OnClick handler will never be detected.

Anyone have a different result?

Code: Select all

Dialog>Dialog1
object Dialog1: TForm
end
EndDialog>Dialog1

AddDialogHandler>Dialog1,,OnMouseDown,MD
AddDialogHandler>Dialog1,,OnClick,CK
//AddDialogHandler>Dialog1,,OnMouseDown,MD

AddDialogHandler>Dialog1,,OnClose,Quit

Show>Dialog1

Label>Loop
Wait>0.01
Goto>Loop

SRT>CK
  MDL>Click
END>CK

SRT>MD
  MDL>down
END>MD

SRT>Quit
  Exit>0
END>Quit

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Mon Jun 24, 2013 3:24 pm

Same result on my Windows 7 machine.

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Jun 24, 2013 5:54 pm

Thanks Rain. How about win8?

User avatar
Phil Pendlebury
Automation Wizard
Posts: 538
Joined: Tue Jan 16, 2007 9:00 am
Contact:

Post by Phil Pendlebury » Tue Jun 25, 2013 9:10 am

Same on Windows 8 (Pro 64 - tested in admin and normal mode).

But I am not sure that this is incorrect behaviour. Would you expect both to trigger?
Phil Pendlebury - Linktree

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Jun 25, 2013 10:25 am

I think this is to be expected. The MouseDown is the first part of a MouseClick, so that event gets fired first and then the MouseClick is missed.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Tue Jun 25, 2013 10:32 am

Marcus Tettmar wrote:I think this is to be expected. The MouseDown is the first part of a MouseClick, so that event gets fired first and then the MouseClick is missed.
I was just thinking about this, went to click reply, when I did I saw Marcus's comment. I think that is pretty much expected, however thought that the next SRT would of been fired once the mouse was released therefore completing the mouse click.
FIREFIGHTER

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Jul 11, 2013 7:21 pm

I wasn't suggesting that this is a bug. As the Subject line states, this is an FYI, something to be aware of.

And I agree with CyberCitizen. I'm surprised that both subroutines don't get called. And in fact, (another FYI), If you change the OnMouseDown to OnMouseUp, both subroutines are run with the sub associated with OnClick running first and the sub associated with OnMouseUp running second. Both run after the mouse is released, one after the other.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts