ThisForm.Release isn't ThisForm.Releasing??? 
Author Message
 ThisForm.Release isn't ThisForm.Releasing???

Hi all,

Okay, I'm probably missing something silly.  But here's the problem on
VFP6sp4, Win95.  I've got a form class, BasicDialog, that has a space for a
message w/ OK and Cancel buttons, both of which have THISFORM.RELEASE() in
the click method.

The form is instantiated and manipulated as follows

frmListProblems = CreateObject( "BasicDialog" )
WITH frmListProblems
  .WindowType = 1
.
.  && <snip> code to add a list & set some properties of the form and its
objects
.
  .Show(1)
ENDWITH

The close button (or whatever the X in upper right is called) closes the
form but OK and Cancel don't.  I've stepped through the code and watched two
ThisForm.Release()'s execute (parent class code does the same thing, for
now) but the form remains visible and active.

So what did I overlook?

TIA,

John



Sun, 23 Feb 2003 02:22:14 GMT  
 ThisForm.Release isn't ThisForm.Releasing???
What's the code that you snipped?  Are you creating an object in one of
these properties that you're setting?  If you are, you might need to clear
out the object before releasing the form.

--
Fred


Quote:
> Hi all,

> Okay, I'm probably missing something silly.  But here's the problem on
> VFP6sp4, Win95.  I've got a form class, BasicDialog, that has a space for
a
> message w/ OK and Cancel buttons, both of which have THISFORM.RELEASE() in
> the click method.

> The form is instantiated and manipulated as follows

> frmListProblems = CreateObject( "BasicDialog" )
> WITH frmListProblems
>   .WindowType = 1
> .
> .  && <snip> code to add a list & set some properties of the form and its
> objects
> .
>   .Show(1)
> ENDWITH

> The close button (or whatever the X in upper right is called) closes the
> form but OK and Cancel don't.  I've stepped through the code and watched
two
> ThisForm.Release()'s execute (parent class code does the same thing, for
> now) but the form remains visible and active.

> So what did I overlook?

> TIA,

> John



Sun, 23 Feb 2003 02:39:24 GMT  
 ThisForm.Release isn't ThisForm.Releasing???
Also release the object reference frmListProblems

Greetings,

KW



Sun, 23 Feb 2003 02:46:48 GMT  
 ThisForm.Release isn't ThisForm.Releasing???
Thanks Ko and Fred.  Following is the unsnipped code (I sometimes cloud the
issue with my snipping!).  It basically adds a listbox to the form, text to
an existing object and resizes/positions objects.

While in development, I'm currently just running it from a short .prg.  I've
tried declaring frmListProblems PUBLIC and doing a RELEASE frmListProblems
in the OK's click(), but still no luck.

I've also tried commenting out the .WindowType setting and creating a form
based on the class and opening it with "DO FORM TEMP_1 NAME frmListProblems
NOSHOW"--same results.  Weird, huh?

frmListProblems = CreateObject( "BasicDialog" )
WITH frmListProblems
  .Height = 200
  .Width = 350
  .btgOKCancel.Top = 200 - .btgOKCancel.Height
  .AutoCenter = .T.

  * Add a listbox to display some bad file names
  .AddObject( "lstIssueFiles", "ListBoxCC" )
  WITH .lstIssueFiles
   .Left = 2
   .Top = 44
   .Width = .Parent.Width - 4
   .Height = .Parent.Height - 30 - .Top
   FOR Cntr = 1 TO ALEN( aSourceFiles, 1 )
    IF !aSourceFiles[Cntr, 2]
     .AddListItem( aSourceFiles[ Cntr, 1 ])
    ENDIF
   ENDFOR
   .Visible = .T.
  ENDWITH

  .edtMessage.Value = "The format for the following files could not be
determined.  " + ;
    "They will not be included in the import."
  .edtMessage.Height = 40
  .Show(1)
ENDWITH


Quote:
> Also release the object reference frmListProblems

> Greetings,

> KW



Sun, 23 Feb 2003 03:16:11 GMT  
 ThisForm.Release isn't ThisForm.Releasing???
In your form Destroy method, try doing:

thisform.RemoveObject("lstIssueFiles")

You still have this added object reference{*filter*} around keeping your form
open.

--
Fred


Quote:
> Thanks Ko and Fred.  Following is the unsnipped code (I sometimes cloud
the
> issue with my snipping!).  It basically adds a listbox to the form, text
to
> an existing object and resizes/positions objects.

> While in development, I'm currently just running it from a short .prg.
I've
> tried declaring frmListProblems PUBLIC and doing a RELEASE frmListProblems
> in the OK's click(), but still no luck.

> I've also tried commenting out the .WindowType setting and creating a form
> based on the class and opening it with "DO FORM TEMP_1 NAME
frmListProblems
> NOSHOW"--same results.  Weird, huh?

> frmListProblems = CreateObject( "BasicDialog" )
> WITH frmListProblems
>   .Height = 200
>   .Width = 350
>   .btgOKCancel.Top = 200 - .btgOKCancel.Height
>   .AutoCenter = .T.

>   * Add a listbox to display some bad file names
>   .AddObject( "lstIssueFiles", "ListBoxCC" )
>   WITH .lstIssueFiles
>    .Left = 2
>    .Top = 44
>    .Width = .Parent.Width - 4
>    .Height = .Parent.Height - 30 - .Top
>    FOR Cntr = 1 TO ALEN( aSourceFiles, 1 )
>     IF !aSourceFiles[Cntr, 2]
>      .AddListItem( aSourceFiles[ Cntr, 1 ])
>     ENDIF
>    ENDFOR
>    .Visible = .T.
>   ENDWITH

>   .edtMessage.Value = "The format for the following files could not be
> determined.  " + ;
>     "They will not be included in the import."
>   .edtMessage.Height = 40
>   .Show(1)
> ENDWITH



> > Also release the object reference frmListProblems

> > Greetings,

> > KW



Sun, 23 Feb 2003 03:39:21 GMT  
 ThisForm.Release isn't ThisForm.Releasing???
The reference to the form that is still open is the with ... pointer. Don't
use with... for the show method.

Robert


Quote:
> In your form Destroy method, try doing:

> thisform.RemoveObject("lstIssueFiles")

> You still have this added object reference{*filter*} around keeping your
form
> open.

> --
> Fred



> > Thanks Ko and Fred.  Following is the unsnipped code (I sometimes cloud
> the
> > issue with my snipping!).  It basically adds a listbox to the form, text
> to
> > an existing object and resizes/positions objects.

> > While in development, I'm currently just running it from a short .prg.
> I've
> > tried declaring frmListProblems PUBLIC and doing a RELEASE
frmListProblems
> > in the OK's click(), but still no luck.

> > I've also tried commenting out the .WindowType setting and creating a
form
> > based on the class and opening it with "DO FORM TEMP_1 NAME
> frmListProblems
> > NOSHOW"--same results.  Weird, huh?

> > frmListProblems = CreateObject( "BasicDialog" )
> > WITH frmListProblems
> >   .Height = 200
> >   .Width = 350
> >   .btgOKCancel.Top = 200 - .btgOKCancel.Height
> >   .AutoCenter = .T.

> >   * Add a listbox to display some bad file names
> >   .AddObject( "lstIssueFiles", "ListBoxCC" )
> >   WITH .lstIssueFiles
> >    .Left = 2
> >    .Top = 44
> >    .Width = .Parent.Width - 4
> >    .Height = .Parent.Height - 30 - .Top
> >    FOR Cntr = 1 TO ALEN( aSourceFiles, 1 )
> >     IF !aSourceFiles[Cntr, 2]
> >      .AddListItem( aSourceFiles[ Cntr, 1 ])
> >     ENDIF
> >    ENDFOR
> >    .Visible = .T.
> >   ENDWITH

> >   .edtMessage.Value = "The format for the following files could not be
> > determined.  " + ;
> >     "They will not be included in the import."
> >   .edtMessage.Height = 40
> >   .Show(1)
> > ENDWITH



> > > Also release the object reference frmListProblems

> > > Greetings,

> > > KW



Sun, 23 Feb 2003 05:21:10 GMT  
 ThisForm.Release isn't ThisForm.Releasing???
Good point about WITH{*filter*} on to the reference.  That one bit me a long
time ago and it took forever to find it.  Thanks for the reminder!

--
Fred



Quote:
> The reference to the form that is still open is the with ... pointer.
Don't
> use with... for the show method.

> Robert



> > In your form Destroy method, try doing:

> > thisform.RemoveObject("lstIssueFiles")

> > You still have this added object reference{*filter*} around keeping your
> form
> > open.

> > --
> > Fred



> > > Thanks Ko and Fred.  Following is the unsnipped code (I sometimes
cloud
> > the
> > > issue with my snipping!).  It basically adds a listbox to the form,
text
> > to
> > > an existing object and resizes/positions objects.

> > > While in development, I'm currently just running it from a short .prg.
> > I've
> > > tried declaring frmListProblems PUBLIC and doing a RELEASE
> frmListProblems
> > > in the OK's click(), but still no luck.

> > > I've also tried commenting out the .WindowType setting and creating a
> form
> > > based on the class and opening it with "DO FORM TEMP_1 NAME
> > frmListProblems
> > > NOSHOW"--same results.  Weird, huh?

> > > frmListProblems = CreateObject( "BasicDialog" )
> > > WITH frmListProblems
> > >   .Height = 200
> > >   .Width = 350
> > >   .btgOKCancel.Top = 200 - .btgOKCancel.Height
> > >   .AutoCenter = .T.

> > >   * Add a listbox to display some bad file names
> > >   .AddObject( "lstIssueFiles", "ListBoxCC" )
> > >   WITH .lstIssueFiles
> > >    .Left = 2
> > >    .Top = 44
> > >    .Width = .Parent.Width - 4
> > >    .Height = .Parent.Height - 30 - .Top
> > >    FOR Cntr = 1 TO ALEN( aSourceFiles, 1 )
> > >     IF !aSourceFiles[Cntr, 2]
> > >      .AddListItem( aSourceFiles[ Cntr, 1 ])
> > >     ENDIF
> > >    ENDFOR
> > >    .Visible = .T.
> > >   ENDWITH

> > >   .edtMessage.Value = "The format for the following files could not be
> > > determined.  " + ;
> > >     "They will not be included in the import."
> > >   .edtMessage.Height = 40
> > >   .Show(1)
> > > ENDWITH



> > > > Also release the object reference frmListProblems

> > > > Greetings,

> > > > KW



Sun, 23 Feb 2003 04:49:28 GMT  
 ThisForm.Release isn't ThisForm.Releasing???

Many thanks, all.  The WITH was the problem.  And subtle enough that I
didn't feel like an absolute moron for missing it!

Thanks again,

John

Quote:
> Good point about WITH{*filter*} on to the reference.  That one bit me a long
> time ago and it took forever to find it.  Thanks for the reminder!

> --
> Fred



> > The reference to the form that is still open is the with ... pointer.
> Don't
> > use with... for the show method.

> > Robert



> > > In your form Destroy method, try doing:

> > > thisform.RemoveObject("lstIssueFiles")

> > > You still have this added object reference{*filter*} around keeping your
> > form
> > > open.

> > > --
> > > Fred



> > > > Thanks Ko and Fred.  Following is the unsnipped code (I sometimes
> cloud
> > > the
> > > > issue with my snipping!).  It basically adds a listbox to the form,
> text
> > > to
> > > > an existing object and resizes/positions objects.

> > > > While in development, I'm currently just running it from a short
.prg.
> > > I've
> > > > tried declaring frmListProblems PUBLIC and doing a RELEASE
> > frmListProblems
> > > > in the OK's click(), but still no luck.

> > > > I've also tried commenting out the .WindowType setting and creating
a
> > form
> > > > based on the class and opening it with "DO FORM TEMP_1 NAME
> > > frmListProblems
> > > > NOSHOW"--same results.  Weird, huh?

> > > > frmListProblems = CreateObject( "BasicDialog" )
> > > > WITH frmListProblems
> > > >   .Height = 200
> > > >   .Width = 350
> > > >   .btgOKCancel.Top = 200 - .btgOKCancel.Height
> > > >   .AutoCenter = .T.

> > > >   * Add a listbox to display some bad file names
> > > >   .AddObject( "lstIssueFiles", "ListBoxCC" )
> > > >   WITH .lstIssueFiles
> > > >    .Left = 2
> > > >    .Top = 44
> > > >    .Width = .Parent.Width - 4
> > > >    .Height = .Parent.Height - 30 - .Top
> > > >    FOR Cntr = 1 TO ALEN( aSourceFiles, 1 )
> > > >     IF !aSourceFiles[Cntr, 2]
> > > >      .AddListItem( aSourceFiles[ Cntr, 1 ])
> > > >     ENDIF
> > > >    ENDFOR
> > > >    .Visible = .T.
> > > >   ENDWITH

> > > >   .edtMessage.Value = "The format for the following files could not
be
> > > > determined.  " + ;
> > > >     "They will not be included in the import."
> > > >   .edtMessage.Height = 40
> > > >   .Show(1)
> > > > ENDWITH



> > > > > Also release the object reference frmListProblems

> > > > > Greetings,

> > > > > KW



Sun, 23 Feb 2003 05:29:55 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. RELEASE THISFORM vs THISFORM.Release()

2. THISFORM.Release() .vs. RELEASE THISFORM

3. RELEASE THISFORM vs. THISFORM.Release()

4. ThisForm.Release...No It Doesn't!

5. ThisForm.Release() dson't work

6. thisForm.Release doesn't work

7. Thisform.release

8. thisform.release() does not work

9. THISFORM.RELEASE in Visual FoxPro

10. Having probs with RELEASE THISFORM on third form

11. VFP7 QueryUnload fires at ThisForm.Release?

12. Thisform.release from INIT event

 

 
Powered by phpBB® Forum Software