Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Samir H.
  Where is Samir H.?
 Yogyakarta
 Indonesia
 Samir H.
 To: Stefan Wuebbe
  Where is Stefan Wuebbe?
 Hamburg
 Germany
 Stefan Wuebbe
 Tags
Subject: RE: Mimic runtime BROWSE ?
Thread ID: 289257 Message ID: 289283 # Views: 42 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Forms
Date: Thursday, December 30, 2010 10:17:14 AM         
   


> Hi Samir,
>
> > Hi all
> > I am creating a form to replace the BROWSE that I use in my runtine app.
> > I would like the form to release when the user clicks somewhere outside of the form, i.e. he clicks the screen, a menu or anything else outside the borders of my frmBrowse.scx.
> > Just like the BROWSE behavior at runtime (without the SAVE clause). If we click outside of the browse-grid, the grid disapears.
> >
> > Problem: I have put thisform.release() in form.lostfocus(), and the result is as expected, but it works only on modeless forms, which means that code after [DO FORM frmBrowse] runs right away when running the custom-browse form. I do not want that: I want the code to wait until frmBrowse is released, and then run.
> >
> > If I use a modal form, everything is fine. Code after [DO FORM frmBrowse] runs only after the form is released. But the user can't click outside the form to release it, which I think is convenient.
> >
> > The vfp BROWSE command can combine those 2 modal-modeless functions. Is it possible with a form?
> >
>
>
> I believe there is no OOP Form event running when the form is modal and mouse click happens outside.
> But an On Key Label would run, see sample pasted below.
>
>
>
> hth
> -Stefan
>
>
>
> CLEAR
> 
> LOCAL oForm
> oForm = CREATEOBJECT('TestForm')
> oForm.Caption = "Modal Form, click outside to release"
> oForm.Show(1)
> RETURN
> 
> DEFINE CLASS TestForm as Form
> 	AutoCenter = .T.
> 	AllowOutput = .F.
> 
> 	PROCEDURE Activate()
> 		ON KEY LABEL leftmouse ;
> 			IIF( TYPE('_screen.ActiveForm.Name')='C' AND PEMSTATUS(_screen.ActiveForm,'MouseOutside',5), ;
> 			_screen.ActiveForm.MouseOutside(), ;
> 			.T. )
> 	ENDPROC
> 	PROCEDURE Destroy()
> 		ON KEY LABEL leftmouse
> 	ENDPROC
> 	PROCEDURE MouseOutside()
> 		lnCol = MCOL('',3)
> 		lnRow = MROW('',3)
> 		IF BETWEEN(m.lnCol, Thisform.Left,Thisform.Left+Thisform.Width) ;
> 		AND BETWEEN(m.lnRow, Thisform.Top,Thisform.Top+Thisform.Height)
> 			RETURN
> 		ENDIF
> 
> 		? LOWER(PROGRAM())
> 		ON KEY LABEL leftmouse
> 		Thisform.Release()
> 	ENDPROC
> ENDDEFINE
> 



Hello Stefan, I did a quick test and the code works. Thanks.
Do you think VFP makes something similar to what you did when I do a BROWSE LAST in a runtime exe? Because the browse window is not modal, but it still waits before running code that comes after the BROWSE command...


Regards
Samir

ENTIRE THREAD

Mimic runtime BROWSE ? Posted by Samir H. @ 12/30/2010 5:25:02 AM
RE: Mimic runtime BROWSE ? Posted by Stefan Wuebbe @ 12/30/2010 9:52:13 AM
RE: Mimic runtime BROWSE ? Posted by Samir H. @ 12/30/2010 10:17:14 AM
RE: Mimic runtime BROWSE ? Posted by Stefan Wuebbe @ 12/31/2010 9:43:26 AM
RE: Mimic runtime BROWSE ? Posted by Samir H. @ 12/31/2010 9:49:00 AM
RE: Mimic runtime BROWSE ? Posted by Stefan Wuebbe @ 12/31/2010 9:57:32 AM
RE: Mimic runtime BROWSE ? Posted by Koen Piller @ 12/30/2010 10:05:05 AM
RE: Mimic runtime BROWSE ? Posted by Samir H. @ 12/30/2010 10:12:28 AM
RE: Mimic runtime BROWSE ? Posted by Samir H. @ 12/31/2010 3:32:05 AM