Automatically releasing all opened forms in an application 
Author Message
 Automatically releasing all opened forms in an application

Hi,

sometimes it is necessary to shut automatically all open forms
in an application ( e.g. to log on as an different user, ... )

This forms can either be modal or modeless.

I tried
...
do while type('_screen.activeform') = 'O'
 IF pemstatus(_screen.Activeform,'Close',5)
  _screen.activeform.Close()     && alle aktiven Fenster schliessen
  else
  _screen.activeform.Release()
 Endif
Enddo
...

This Version hangs up the Foxpro-application, because
the Form _screen.activeform exists still after releasing ...
( never ending Loop on the same Form )

Then I tried

FOR i = 1 TO _screen.FormCount
     _screen.Forms(i).release()
ENDFOR

This ends with the error-Message : Form is no object
at the last Form, which keeps beeing open in the application

Who can help me ?

Thanks

Stefan Kalis



Tue, 09 Jan 2001 03:00:00 GMT  
 Automatically releasing all opened forms in an application
Stefan,

Try the FOR loop this way;

FOR i = 1 TO _screen.FormCount
     _screen.Forms(1).release()
ENDFOR

To explain imagine you have 3 forms up there, the loop releases form 1 and
the counter changes to 2, then form 2 is released and the counter becomes 3,
but now there is no Forms(3) anymore and the last form is never released.
By releasing form 1 each time through the loop you will get to all forms.

JimB

Quote:

>Hi,

>sometimes it is necessary to shut automatically all open forms
>in an application ( e.g. to log on as an different user, ... )

>This forms can either be modal or modeless.

>I tried
>....
>do while type('_screen.activeform') = 'O'
> IF pemstatus(_screen.Activeform,'Close',5)
>  _screen.activeform.Close()     && alle aktiven Fenster schliessen
>  else
>  _screen.activeform.Release()
> Endif
>Enddo
>....

>This Version hangs up the Foxpro-application, because
>the Form _screen.activeform exists still after releasing ...
>( never ending Loop on the same Form )

>Then I tried

>FOR i = 1 TO _screen.FormCount
>     _screen.Forms(i).release()
>ENDFOR

>This ends with the error-Message : Form is no object
>at the last Form, which keeps beeing open in the application

>Who can help me ?

>Thanks

>Stefan Kalis




Fri, 12 Jan 2001 03:00:00 GMT  
 Automatically releasing all opened forms in an application
Try clear events after that
Quote:

>Hi,

>sometimes it is necessary to shut automatically all open forms
>in an application ( e.g. to log on as an different user, ... )

>This forms can either be modal or modeless.

>I tried
>....
>do while type('_screen.activeform') = 'O'
> IF pemstatus(_screen.Activeform,'Close',5)
>  _screen.activeform.Close()     && alle aktiven Fenster schliessen
>  else
>  _screen.activeform.Release()
> Endif
>Enddo
>....

>This Version hangs up the Foxpro-application, because
>the Form _screen.activeform exists still after releasing ...
>( never ending Loop on the same Form )

>Then I tried

>FOR i = 1 TO _screen.FormCount
>     _screen.Forms(i).release()
>ENDFOR

>This ends with the error-Message : Form is no object
>at the last Form, which keeps beeing open in the application

>Who can help me ?

>Thanks

>Stefan Kalis




Fri, 12 Jan 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Going crazy with opened tables when form is already released

2. Open and release form problem...

3. vfp7 form.release or release window?

4. form.Release not releasing

5. Combo box - pop open automatically on entry???

6. Synchronize navigation toolbars when a cdx is open automatically

7. FPW 2.6: Screen Code automatically opens table from tutorial

8. Release form problem (after filling form property)

9. VFP Open Source Webserver is released

10. release form - from menubar of top level form ?

11. How to release a form from another form

12. DO FORM and RELEASE FORM troubles.

 

 
Powered by phpBB® Forum Software