releasing all active forms 
Author Message
 releasing all active forms

Hi,

You can try:

for each oForm in _screen.forms
    oForm.release()
endfor

Hugo


Quote:
> Hello,
>    Is there a way to relase all current active forms??

> Will



Sun, 01 Dec 2002 03:00:00 GMT  
 releasing all active forms
Hello,
   Is there a way to relase all current active forms??

Will



Sun, 01 Dec 2002 03:00:00 GMT  
 releasing all active forms
Yes, I handle this quite easily.

When I open the form I add a reference to it in a array of forms call
aform[].

Then I just say
aforms = null or .f.
to clear the array and hence destroy all the forms.

Regards,

Karl D-B

LOCAL nFormLeft, nFormTop, cFormCaption
nInstance = ALEN(goAppInfo.aForms)

* Run the form and assign the object variable to the array element
* The Linked keyword indicates that all instances will be released when
* the array is released. Without 'LINKED', the multiple instance forms
* would persist after the array is released
DO FORM &sFormName NAME goAppInfo.aForms[nInstance] WITH ;
     nFormTop, nFormLeft LINKED
*Redimension the array so that more instances of the form can be launched
DIMENSION goAppInfo.aforms[nInstance + 1]


Quote:
> Hello,
>    Is there a way to relase all current active forms??

> Will



Sun, 01 Dec 2002 03:00:00 GMT  
 releasing all active forms

Quote:
> for each oForm in _screen.forms
>     oForm.release()
> endfor

Wow! Thats tricky code. _screen.forms decreases in length during the loop
and still you use it to determine the loop iteration.

Are you sure this is a good advice?

I'd go for rele wind all

Robert

Quote:
> Hugo



> > Hello,
> >    Is there a way to relase all current active forms??

> > Will



Sun, 01 Dec 2002 03:00:00 GMT  
 releasing all active forms
That won't work, as Robert pointed out.  You need to traverse the forms
collection from the end to the beginning.

FOR x=_SCREEN.FormCount TO 1 STEP -1
  _SCREEN.Forms[x].Release()
ENDFOR

Fred


Quote:
> Hi,

> You can try:

> for each oForm in _screen.forms
>     oForm.release()
> endfor

> Hugo



> > Hello,
> >    Is there a way to relase all current active forms??

> > Will



Sun, 01 Dec 2002 03:00:00 GMT  
 releasing all active forms
Hi,
Yes, my mistake. I forgot that _screen.forms will change each iteration,
then I looked at my own function and this is what I do, very similar to
Fred's

* Function closeforms
* Release all open forms in _screen
local i

for i=1 to _screen.formcount
 _screen.forms[1].release()
next

Sorry, I cannot trust in my memory anymore, I should have checked it.

Hugo


Quote:
> That won't work, as Robert pointed out.  You need to traverse the forms
> collection from the end to the beginning.

> FOR x=_SCREEN.FormCount TO 1 STEP -1
>   _SCREEN.Forms[x].Release()
> ENDFOR

> Fred



> > Hi,

> > You can try:

> > for each oForm in _screen.forms
> >     oForm.release()
> > endfor

> > Hugo



> > > Hello,
> > >    Is there a way to relase all current active forms??

> > > Will



Sun, 01 Dec 2002 03:00:00 GMT  
 releasing all active forms
You are right, I am changing my function now, before I forgot, thanks.

Hugo


Quote:
> Yep, that will certainly work OK, as long as the Forms[1] form actually
> releases.  If it does not release, you'll end up in an endless loop.  You
> might want to consider that fact.

> Memory.  If I tried to rely on my own memory I'd forget....uh, what were
we
> talking about? ;)

> Fred



> > Hi,
> > Yes, my mistake. I forgot that _screen.forms will change each iteration,
> > then I looked at my own function and this is what I do, very similar to
> > Fred's

> > * Function closeforms
> > * Release all open forms in _screen
> > local i

> > for i=1 to _screen.formcount
> >  _screen.forms[1].release()
> > next

> > Sorry, I cannot trust in my memory anymore, I should have checked it.

> > Hugo



> > > That won't work, as Robert pointed out.  You need to traverse the
forms
> > > collection from the end to the beginning.

> > > FOR x=_SCREEN.FormCount TO 1 STEP -1
> > >   _SCREEN.Forms[x].Release()
> > > ENDFOR

> > > Fred



> > > > Hi,

> > > > You can try:

> > > > for each oForm in _screen.forms
> > > >     oForm.release()
> > > > endfor

> > > > Hugo



> > > > > Hello,
> > > > >    Is there a way to relase all current active forms??

> > > > > Will



Sun, 01 Dec 2002 03:00:00 GMT  
 releasing all active forms
Yep, that will certainly work OK, as long as the Forms[1] form actually
releases.  If it does not release, you'll end up in an endless loop.  You
might want to consider that fact.

Memory.  If I tried to rely on my own memory I'd forget....uh, what were we
talking about? ;)

Fred


Quote:
> Hi,
> Yes, my mistake. I forgot that _screen.forms will change each iteration,
> then I looked at my own function and this is what I do, very similar to
> Fred's

> * Function closeforms
> * Release all open forms in _screen
> local i

> for i=1 to _screen.formcount
>  _screen.forms[1].release()
> next

> Sorry, I cannot trust in my memory anymore, I should have checked it.

> Hugo



> > That won't work, as Robert pointed out.  You need to traverse the forms
> > collection from the end to the beginning.

> > FOR x=_SCREEN.FormCount TO 1 STEP -1
> >   _SCREEN.Forms[x].Release()
> > ENDFOR

> > Fred



> > > Hi,

> > > You can try:

> > > for each oForm in _screen.forms
> > >     oForm.release()
> > > endfor

> > > Hugo



> > > > Hello,
> > > >    Is there a way to relase all current active forms??

> > > > Will



Sun, 01 Dec 2002 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. vfp7 form.release or release window?

2. form.Release not releasing

3. Help: Form.Refresh() doesn't work for active form if mutiple forms on screen

4. Active Web Toolkit Release Announcement

5. Release form problem (after filling form property)

6. Top level form menu & active form

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

8. How to release a form from another form

9. DO FORM and RELEASE FORM troubles.

10. Making a form the active form

11. RELEASE LIBRARY does not release memory

12. RELEASE THISFORM vs THISFORM.Release()

 

 
Powered by phpBB® Forum Software