Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Modal form auto close
Message
From
12/02/2002 02:31:50
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00618679
Message ID:
00618695
Views:
19
This message has been marked as a message which has helped to the initial question of the thread.
>I have a modal form. I want to set it up so that when the user clicks anywhere ouside that from it automatically closes. Can I do this? If so, how? I tried to use the deactivate and lostfocus events of the form, but it didnt work.
>
>Any help is appreciated
>Eric Stephani

Eric,
This might not be elegant but a working solution :
* A timer on form with interval 10
*Form.Load
Declare short GetCursorPos in win32api string @ lpPoint
DECLARE RtlMoveMemory IN WIN32API ;
	INTEGER @DestNumeric, ;
	STRING @pVoidSource, ;
	INTEGER nLength
declare short ScreenToClient in win32API ;
  integer hWnd,  string @ lpPoint
set library to home()+'foxtools.fll' additive

*Timer1.interval = 10
*timer1.timer
With thisform
  If mdown()
    Store 0 to lnPosX,lnPosY
    lpPoint = space(8)
    If GetCursorPos(@lpPoint)#0
      ScreenToClient(_WhToHwnd(_WOnTop()),@lpPoint)
      RtlMoveMemory(@lnPosX, left(lpPoint,4), 4)
      RtlMoveMemory(@lnPosY, right(lpPoint,4), 4)
      If !between(lnPosX, 0-sysmetric(3), .width+sysmetric(3)) ;
          or !between(lnPosY, 0-sysmetric(4)-sysmetric(19),.height+sysmetric(4))
        .release
      Endif
    Endif
  Endif
Endwith
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform