I just needed something like this, and for I did not find any better solution (Although I am sure I could bind to some windows event, it was an overkiller to my small app), I used a timer, in my case is good enough, not sure in yours thou.
This is the code in the Timer event (my form is modal)
this.Enabled = .f.
local laObjects(1), lnObjects
lnObjects = Amouseobj(laObjects, 1)
if lnObjects = 0 or laObjects[1, 2] # this.Parent
this.Parent.Hide()
endif
this.Enabled = this.Parent.Visible
Ah, and the interval I set it to 333 just by testing differnt values
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?
"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare
"To die for a religion is easier than to live it absolutely"
Jorge L. Borges