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
14/10/2002 03:22:57
 
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00710203
Message ID:
00710845
Views:
13
Hi!

Nice solution, indeed! You do not need though to compare HWND property - VFP compares objects very well. So, you can just use "loUnderPointer = thisform" to check if it is the same form :-)


>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.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform