Release form problem (after filling form property) 
Author Message
 Release form problem (after filling form property)

Hi y'all

I have a problem with releasing a form. This is the case.
I have a form with a custom property and a custom method. This property
is defined as an array and the method is used to fill the array. In the
Init() of this form I call this method. The array gets filled with
information concerning all objects on the form. All the information that
is gathered is stored as strings.
Now when I try to close this form (ThisForm.Release()) nothing happens.
The form doesn't get released.
If I leave out the part where I fill the array, everything works just
fine. The form is released as it should be.

This is the code that fills the array. The method GetRelatieveObjectNaam
takes 2 parameters: a string and a reference to the current object
(current object being
ThisForm.Controls(lnControlCounter) .

FOR lnControlCounter = 1 TO ThisForm.ControlCount
        DIMENSION ThisForm.ControlArray[lnControlCounter, 3]
        ThisForm.ControlArray[lnControlCounter, 1] = SYS(1272,
ThisForm.Controls(lnControlCounter))
        ThisForm.ControlArray[lnControlCounter, 2] =
oApp.GetRelatieveObjectNaam(SYS(1272,
ThisForm.Controls(lnControlCounter)), ;
                        ThisForm.Controls(lnControlCounter))

        IF PEMSTATUS(ThisForm.Controls(lnControlCounter),
"ControlSource", 5)
                ThisForm.ControlArray[lnControlCounter, 3] =
ThisForm.Controls(lnControlCounter).ControlSource
        ENDIF
NEXT

I hope someone can help, 'cause this problem is eating me. There ain't
much left of me ;-(

TIA,
Jaap van Braam Houckgeest
Dieke & vd Beek IT Consultants
Heerde, The Netherlands



Sat, 17 Feb 2001 03:00:00 GMT  
 Release form problem (after filling form property)

Quote:

> Hi y'all

> I have a problem with releasing a form. This is the case.
> I have a form with a custom property and a custom method. This property
> is defined as an array and the method is used to fill the array. In the
> Init() of this form I call this method. The array gets filled with
> information concerning all objects on the form. All the information that
> is gathered is stored as strings.
> Now when I try to close this form (ThisForm.Release()) nothing happens.
> The form doesn't get released.
> If I leave out the part where I fill the array, everything works just
> fine. The form is released as it should be.

> This is the code that fills the array. The method GetRelatieveObjectNaam
> takes 2 parameters: a string and a reference to the current object
> (current object being
> ThisForm.Controls(lnControlCounter) .

> FOR lnControlCounter = 1 TO ThisForm.ControlCount
>         DIMENSION ThisForm.ControlArray[lnControlCounter, 3]
>         ThisForm.ControlArray[lnControlCounter, 1] = SYS(1272,
> ThisForm.Controls(lnControlCounter))
>         ThisForm.ControlArray[lnControlCounter, 2] =
> oApp.GetRelatieveObjectNaam(SYS(1272,
> ThisForm.Controls(lnControlCounter)), ;
>                         ThisForm.Controls(lnControlCounter))

>         IF PEMSTATUS(ThisForm.Controls(lnControlCounter),
> "ControlSource", 5)
>                 ThisForm.ControlArray[lnControlCounter, 3] =
> ThisForm.Controls(lnControlCounter).ControlSource
>         ENDIF
> NEXT

> I hope someone can help, 'cause this problem is eating me. There ain't
> much left of me ;-(

> TIA,
> Jaap van Braam Houckgeest
> Dieke & vd Beek IT Consultants
> Heerde, The Netherlands


Hi Jaap,
  I've a draft look at your code, still I am not sure why it doesn't work,
(at lease it looks fine)
but I wonder why the DEMINSION statement is inside the FOR loop?
this will dimension as many times as the number of controls in the form...
why don't you rearrange like this :

DIMENSION ThisForm.ControlArray[lnControlCounter, ThisForm.ControlCount]
FOR lnC.....

 at lease it saves you many times.



Sun, 18 Feb 2001 03:00:00 GMT  
 Release form problem (after filling form property)
After you load you array, place a SET STEP ON and
in the de{*filter*} tools check the content of the array to
ensure that you did not load any object references.

Also, you might try in your Form.Unload to:
  STORE [] TO ThisForm.ControlArray

-myron kirby-
Independent Consultant

===========================

Quote:

>Hi y'all

>I have a problem with releasing a form. This is the case.
>I have a form with a custom property and a custom method. This property
>is defined as an array and the method is used to fill the array. In the
>Init() of this form I call this method. The array gets filled with
>information concerning all objects on the form. All the information that
>is gathered is stored as strings.
>Now when I try to close this form (ThisForm.Release()) nothing happens.
>The form doesn't get released.
>If I leave out the part where I fill the array, everything works just
>fine. The form is released as it should be.

>This is the code that fills the array. The method GetRelatieveObjectNaam
>takes 2 parameters: a string and a reference to the current object
>(current object being
>ThisForm.Controls(lnControlCounter) .

>FOR lnControlCounter = 1 TO ThisForm.ControlCount
> DIMENSION ThisForm.ControlArray[lnControlCounter, 3]
> ThisForm.ControlArray[lnControlCounter, 1] = SYS(1272,
>ThisForm.Controls(lnControlCounter))
> ThisForm.ControlArray[lnControlCounter, 2] =
>oApp.GetRelatieveObjectNaam(SYS(1272,
>ThisForm.Controls(lnControlCounter)), ;
> ThisForm.Controls(lnControlCounter))

> IF PEMSTATUS(ThisForm.Controls(lnControlCounter),
>"ControlSource", 5)
> ThisForm.ControlArray[lnControlCounter, 3] =
>ThisForm.Controls(lnControlCounter).ControlSource
> ENDIF
>NEXT

>I hope someone can help, 'cause this problem is eating me. There ain't
>much left of me ;-(

>TIA,
>Jaap van Braam Houckgeest
>Dieke & vd Beek IT Consultants
>Heerde, The Netherlands




Sun, 18 Feb 2001 03:00:00 GMT  
 Release form problem (after filling form property)
Hi,

Try putting this code in the Form Unload:

STORE .NULL. TO Thisform.ControlArray

Best regards,
Tom

Quote:

>Hi y'all

>I have a problem with releasing a form. This is the case.
>I have a form with a custom property and a custom method. This property
>is defined as an array and the method is used to fill the array. In the
>Init() of this form I call this method. The array gets filled with
>information concerning all objects on the form. All the information that
>is gathered is stored as strings.
>Now when I try to close this form (ThisForm.Release()) nothing happens.
>The form doesn't get released.
>If I leave out the part where I fill the array, everything works just
>fine. The form is released as it should be.

>This is the code that fills the array. The method GetRelatieveObjectNaam
>takes 2 parameters: a string and a reference to the current object
>(current object being
>ThisForm.Controls(lnControlCounter) .

>FOR lnControlCounter = 1 TO ThisForm.ControlCount
> DIMENSION ThisForm.ControlArray[lnControlCounter, 3]
> ThisForm.ControlArray[lnControlCounter, 1] = SYS(1272,
>ThisForm.Controls(lnControlCounter))
> ThisForm.ControlArray[lnControlCounter, 2] =
>oApp.GetRelatieveObjectNaam(SYS(1272,
>ThisForm.Controls(lnControlCounter)), ;
> ThisForm.Controls(lnControlCounter))

> IF PEMSTATUS(ThisForm.Controls(lnControlCounter),
>"ControlSource", 5)
> ThisForm.ControlArray[lnControlCounter, 3] =
>ThisForm.Controls(lnControlCounter).ControlSource
> ENDIF
>NEXT

>I hope someone can help, 'cause this problem is eating me. There ain't
>much left of me ;-(

>TIA,
>Jaap van Braam Houckgeest
>Dieke & vd Beek IT Consultants
>Heerde, The Netherlands




Sun, 18 Feb 2001 03:00:00 GMT  
 Release form problem (after filling form property)
I had a similiar problem, you might try hiding the form until the array
is used for whatever purpose, then release the form after you have used the
array.

HTH

Becky

Quote:

>Hi y'all

>I have a problem with releasing a form. This is the case.
>I have a form with a custom property and a custom method. This property
>is defined as an array and the method is used to fill the array. In the
>Init() of this form I call this method. The array gets filled with
>information concerning all objects on the form. All the information that
>is gathered is stored as strings.
>Now when I try to close this form (ThisForm.Release()) nothing happens.
>The form doesn't get released.
>If I leave out the part where I fill the array, everything works just
>fine. The form is released as it should be.

>This is the code that fills the array. The method GetRelatieveObjectNaam
>takes 2 parameters: a string and a reference to the current object
>(current object being
>ThisForm.Controls(lnControlCounter) .

>FOR lnControlCounter = 1 TO ThisForm.ControlCount
> DIMENSION ThisForm.ControlArray[lnControlCounter, 3]
> ThisForm.ControlArray[lnControlCounter, 1] = SYS(1272,
>ThisForm.Controls(lnControlCounter))
> ThisForm.ControlArray[lnControlCounter, 2] =
>oApp.GetRelatieveObjectNaam(SYS(1272,
>ThisForm.Controls(lnControlCounter)), ;
> ThisForm.Controls(lnControlCounter))

> IF PEMSTATUS(ThisForm.Controls(lnControlCounter),
>"ControlSource", 5)
> ThisForm.ControlArray[lnControlCounter, 3] =
>ThisForm.Controls(lnControlCounter).ControlSource
> ENDIF
>NEXT

>I hope someone can help, 'cause this problem is eating me. There ain't
>much left of me ;-(

>TIA,
>Jaap van Braam Houckgeest
>Dieke & vd Beek IT Consultants
>Heerde, The Netherlands




Mon, 19 Feb 2001 03:00:00 GMT  
 Release form problem (after filling form property)
Hi once again,

thanks to those who posted a reply. Unfortunately, the problem I'm
having seems to be of the persistent persuasion.....
I managed to trace the cause of the problem to my custom method
GetRelatieveObjectNaam. As one can see this method receives a reference
to an object: ThisForm.Controls(lnControlCounter).

The following code shows how this reference is (intended to be) used:

<begin code example>
lcParentString = REPLICATE('Parent.', OCCURS(".", lcAbsoluteObjectNaam))
lcBaseClass = 'loObject.'+lcParentString+'BaseClass'
DO CASE
        CASE UPPER(&lcBaseClass) $ 'FORM FORMSET'
<end code example>

lcAbsoluteObjectNaam and loObject are passed as LPARAMETERS.
lcAbsoluteObjectNaam contains the result of a call to SYS(1272) and
loObject contains the result of (the above mentioned)
ThisForm.Controls(lnControlCounter)

As far as I've been able to determine the problem has something to do
with (the macro) &lcBaseClass.

I hope this additional information encourages y'all to give it (another)
thought ;-)
As of now I'm practically non-existant, because of the highly
unrealistic occurence of being eaten by a problem ;-(

TIA,
Jaap van Braam Houckgeest
Dieke & vd Beek IT Consultants
Heerde, The Netherlands

Quote:
> -----Oorspronkelijk bericht-----
> Van:       jaap
> Gepost om: dinsdag 1 september 1998 14:45
> Gepost naar:       VFP forms
> Discussie: Release form problem (after filling form property)
> Onderwerp: Release form problem (after filling form property)

> Hi y'all

> I have a problem with releasing a form. This is the case.
> I have a form with a custom property and a custom method. This
> property is defined as an array and the method is used to fill the
> array. In the Init() of this form I call this method. The array gets
> filled with information concerning all objects on the form. All the
> information that is gathered is stored as strings.
> Now when I try to close this form (ThisForm.Release()) nothing
> happens. The form doesn't get released.
> If I leave out the part where I fill the array, everything works just
> fine. The form is released as it should be.

> This is the code that fills the array. The method
> GetRelatieveObjectNaam takes 2 parameters: a string and a reference to
> the current object (current object being
> ThisForm.Controls(lnControlCounter) .

> FOR lnControlCounter = 1 TO ThisForm.ControlCount
>    DIMENSION ThisForm.ControlArray[lnControlCounter, 3]
>    ThisForm.ControlArray[lnControlCounter, 1] = SYS(1272,
> ThisForm.Controls(lnControlCounter))
>    ThisForm.ControlArray[lnControlCounter, 2] =
> oApp.GetRelatieveObjectNaam(SYS(1272,
> ThisForm.Controls(lnControlCounter)), ;
>                    ThisForm.Controls(lnControlCounter))

>    IF PEMSTATUS(ThisForm.Controls(lnControlCounter),
> "ControlSource", 5)
>            ThisForm.ControlArray[lnControlCounter, 3] =
> ThisForm.Controls(lnControlCounter).ControlSource
>    ENDIF
> NEXT

> I hope someone can help, 'cause this problem is eating me. There ain't
> much left of me ;-(

> TIA,
> Jaap van Braam Houckgeest
> Dieke & vd Beek IT Consultants
> Heerde, The Netherlands




Mon, 19 Feb 2001 03:00:00 GMT  
 Release form problem (after filling form property)
As Tom implied, you cannot release a form that has outstanding object
references. He suggested removing the references in the Unload() event, but
I think this is too late. We have found that the references must be removed
in the Destroy() event.

David Dunetz
SweetWARE



Tue, 20 Feb 2001 03:00:00 GMT  
 Release form problem (after filling form property)
Hi David,

Thanks for the catch. I do mine in the QueryUnload snippet, which is called
from the Release snippet.

Best regards,
Tom

Quote:

>As Tom implied, you cannot release a form that has outstanding object
>references. He suggested removing the references in the Unload() event, but
>I think this is too late. We have found that the references must be removed
>in the Destroy() event.

>David Dunetz
>SweetWARE



Wed, 21 Feb 2001 03:00:00 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. vfp7 form.release or release window?

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

3. How to release a form from another form

4. form.Release not releasing

5. DO FORM and RELEASE FORM troubles.

6. Changing one form's properties from a different form

7. VFP: Setting default form/form element properties

8. user form property in a private data session form

9. Forms: Converting BMP files to ICO files for use in icon properties of forms

10. Top Level Form, Menus and Form's Properties

11. Can't reference on forms properties from another form

12. Form release problem

 

 
Powered by phpBB® Forum Software