Hi Vlad,
I've tried your idea and also used sys(1270), which I used in some other code successfully.
Now the form will hide if the user clicks outside the form. I can also successfully move the form using the caption, without the risk of a hide. However, resizing the form still gives problems. If I position the mouse very near a border, but INside the form, and then resize, all is okay. But if I position the mouse very near outside the border, it looks asif resizing will gonna succeed, but it won't. Moreover, the HideForm method will be called because sys(1270) will give an object reference to the underlying object's name, for example to 'Screen'.
Who has another idea?
Peter
local loUnderPointer
with thisform
do case
case mdown()
if not .lMouseOnForm
if mrow() < 0 or mcol() < 0
loUnderPointer = sys( 1270 )
.lMouseOnForm = type( 'loUnderPointer' ) = 'O' and loUnderPointer.name = .name
if not .lMouseOnForm
.HideForm()
endif
endif
endif
case .lMouseOnForm
this.interval = 0
inkey(.5)
this.interval = 10
.lMouseOnForm = .f.
.ShowForm()
endcase
endwith
>Hi!
>
>Make a timer with 1 to 10 miliseconds interval. Check in it MDOWN() and MROW()/MCOL() - if mouse button is pressed and is outside of the window. You can also try to use Windows API functions for this for better reliability.
>
>HTH.
>
>>How can I release (thisform.release) a form when the user clicks outside the form? Currently, I have the release code in the Deactivate. Also, the form is invoked with an ON KEY LABEL statement.
>>
>>- I've succeeded when it's a non-modal form and I click outside on a non-modal form.
>>- I've failed when it's a non-modal form and I click outside on a modal form.
>>- I've failed when it's a non-modal form and I click outside on an 'empty' section.
>>- I've failed when it's a modal form and I click outside on a non-modal form.
>>- I've failed when it's a modal form and I click outside on a modal form.
>>- I've failed when it's a modal form and I click outside on an 'empty' section.
>>
>>Suggestions welcome.
Groet,
Peter de Valença
Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.