I made a Canvas class and I have a few instances on a window. With mouseclick I can activate them (gotfocus/lostfocus). If click out of them the last clicked is still in focus.
What I would like is if I click on an empty area on the window that deactivate all of them (focus on the background or something).
My first idea was to put full window size canvas in the background but even if I set it to transparent it covers everything.
Well, I tried Window1.MouseDown but it activates even if I click on the canvas so overwrites everything or I have to check the mouse coordinates if they are on any UI element…
Again, the problem is Window1.MouseDown fires wherever I click on the window (canvas or background) so I can’t use it.
Also, it would be nice to handle this in my class if possible
This is where the chapter on the Event Model in my JavaScript book was so handy. It told me what events propagated, in which direction, and how to prevent it.
This lack of a comprehensive description of the Xojo event model has, IMO, bedevilled understanding.