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 18:46:25
 
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00710203
Message ID:
00710545
Views:
19
Ok, here's the code that does the trick I was seeking for. Vlad suggested a timer, mdown(), mrow() and mcol(). And Ed suggested hWnd. The good thing about hWnd is that it gives the form reference on the caption and the borders also! Thanks to both of you and to Caroline. :)
*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.hWnd = .hWnd
            *
            if not .lMouseOnForm
               .release
            endif
         endif
      endif

   case .lMouseOnForm
      *
      .lMouseOnForm = .f.
   endcase
endwith
>>Peter,
>>
>>Just off the top of my head could you determine if the MouseDown is outside the form by using the Form Top, Left, Height, Width and the current mouse position in the screen. If you can then you could alter the forms Top, Left, Height, Width to give an invisible margin around the form.
>>
>
>The obvious way to do this is to save the hWnd of the Form, and use a timer to detect if the current foreground window has the same hWnd as the form to hide; you can use the template code for detecting when VFP is no longer in foreground that I posted in the FAQ.
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