Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get rid of form by clicking outside the form
Message
From
11/10/2002 11:36:38
 
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00710203
Message ID:
00710366
Views:
16
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
*method TIMER
local loUnderPointer
with thisform
   do case
   case mdown()
      *	
      if not .lMouseOnForm    && userdefined property
         *
         if mrow() < 0 or mcol() < 0
            *
            loUnderPointer = sys( 1270 )
            *
            .lMouseOnForm = type( 'loUnderPointer' ) = 'O' and loUnderPointer.name = .name
            *
            if not .lMouseOnForm
               .HideForm()    && userdefined method that will hide the form
            endif
         endif
      endif
	
   case .lMouseOnForm
      *
      this.interval = 0    && these lines are a try-out only
      inkey(.5)
      this.interval = 10
      .lMouseOnForm = .f.
      .ShowForm()         && userdefined method showing the form
   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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform