How can I test the mouse click position without handling the mousedown event?
I just want to get the mousedown x and y positions to manage something unrelated to the event. If I put a mousdown event in a control, the control stops responding to mouse clicks after the first mousedown event.
Because everything is async, you cant.
@Greg O’Lone Thanks
I have noticed the built in webcontrol.contextualmenu does not close when one clicks outside of the menu which is what I would expect as normal behavior. I’m guessing for the very same reason that what I ws trying to do was not possible.
What I was trying to do was to close a webdialog when a user clicked outside of the dialog.
I have got it working now by changing the dialog from a modal to a palette type and put the code to close the dialog in the mousedown event of the canvas contol behind the dialog. In this scenario, I no longer needed the x,y coordinates.
Does that mean that “everything is async” is in the context of the webdialog but not the canvas control? Why do the canvas control events continue to work after the mouse down event, but not in the webdialog?
Greg, thanks for your input. I always learn something new.
Everything is async in the context that because the user interface (the browser) could technically be thousands of miles away from where the binary of all of your Xojo code is, user initiated events are already long complete before any code runs on the server. You must think of user input, whether by keyboard, mouse or touch, as things that happened in the past and not something that you could interrupt like you can on the desktop when you return True from a MouseDown event to prevent MouseUp from firing.
Its important to remember this when designing and debugging your app locally because the low latency can give a false sense of interactivity.
For clarity, the reason this didnt work is that the dark gray overlay behind the dialog is actually part of the dialog, but has no events associated with it.
[quote]@Greg O’Lone For clarity, the reason this didnt work is that the dark gray overlay behind the dialog is actually part of the dialog, but has no events associated with it.
Actually for me the dark gray overly behind the dialog did in fact fire the dialog’s mousedown event when clicked, providing the x,y coordinates that I needed to test and close the dialog as I wanted. Problem was, with that mousedown event handler in place, the dialog became none responsive.
By changing the dialog to a pallet, I was able to use the mousedown event of the canvas contol behind the dialog to acconplish what I wanted. What has me puzzled is why the mousedown event handler on the dialog rendered it non responsive while the mousedown event handler on the canvas doesn’t also render the canvas non responsive.