I have a very large application that seems to be losing a public object
variable at run-time. I create define a public variable "pScreen",
initialize the variable with a blank string and then issue a command
such to create a form linking the variable to the screen. Such as:

PUBLIC pScreen
pScreen = ""
DO FORM SomeScreen NAME pScreen LINKED NOSHOW
......

Somewhere in the code the variable is undefined (ie. TYPE("pScreen")=
"U"). I know this because when a code tries to reference the pScreen
variable, an exception is thrown. To debug, I set a breakpoint
immediately after the "DO FORM" and put TYPE("pScreen") into the watch
window. I set a breakpoint on the watch for when TYPE("pScreen")
changes. Without any other program code changes, the application runs
fine and the variable never becomes undefined (until I want it to be
undefined)!!! I follow the exact same keystrokes/mouse clicks when
running in debug mode with the watch as without.

Any ideas of why the variable becomes undefined somewhere in the code
but not when a watch/breakpoint is set?

Re: VFP 8.0 losing memory variables by Anders

Anders
Thu Jan 11 14:50:58 CST 2007

Use Code Refereces on the Tools manu to find every place in the entire
project where pScreen is referenced.
-Anders

"Mark" <mminnie@minniebyte.com> skrev i meddelandet
news:1168544886.795187.144460@i39g2000hsf.googlegroups.com...
>I have a very large application that seems to be losing a public object
> variable at run-time. I create define a public variable "pScreen",
> initialize the variable with a blank string and then issue a command
> such to create a form linking the variable to the screen. Such as:
>
> PUBLIC pScreen
> pScreen = ""
> DO FORM SomeScreen NAME pScreen LINKED NOSHOW
> ......
>
> Somewhere in the code the variable is undefined (ie. TYPE("pScreen")=
> "U"). I know this because when a code tries to reference the pScreen
> variable, an exception is thrown. To debug, I set a breakpoint
> immediately after the "DO FORM" and put TYPE("pScreen") into the watch
> window. I set a breakpoint on the watch for when TYPE("pScreen")
> changes. Without any other program code changes, the application runs
> fine and the variable never becomes undefined (until I want it to be
> undefined)!!! I follow the exact same keystrokes/mouse clicks when
> running in debug mode with the watch as without.
>
> Any ideas of why the variable becomes undefined somewhere in the code
> but not when a watch/breakpoint is set?
>



Re: VFP 8.0 losing memory variables by Gene

Gene
Thu Jan 11 16:05:58 CST 2007

"Anders Altberg" <A@A> wrote:

>Use Code Refereces on the Tools manu to find every place in the entire
>project where pScreen is referenced.

And also look for any other commands that release variables (such
as release all and clear all).

[snipped previous]

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.

Re: VFP 8.0 losing memory variables by Carsten

Carsten
Fri Jan 12 01:45:49 CST 2007

Mark,

another idea.
Do you have a "PRIVATE ALL" statement somewhere in you code? The statement
hides all variables.

Try this, to see what i mean:

TEST.PRG
PUBLIC pScreen AS String
pScreen= "Hello"
? type("pScreen")
Foo()

PROCEDURE Foo
PRIVATE ALL
? type("pScreen")
ENDPROC

--
Cheers
Carsten
_______________________________

"Mark" <mminnie@minniebyte.com> schrieb im Newsbeitrag
news:1168544886.795187.144460@i39g2000hsf.googlegroups.com...
>I have a very large application that seems to be losing a public object
> variable at run-time. I create define a public variable "pScreen",
> initialize the variable with a blank string and then issue a command
> such to create a form linking the variable to the screen. Such as:
>
> PUBLIC pScreen
> pScreen = ""
> DO FORM SomeScreen NAME pScreen LINKED NOSHOW
> ......
>
> Somewhere in the code the variable is undefined (ie. TYPE("pScreen")=
> "U"). I know this because when a code tries to reference the pScreen
> variable, an exception is thrown. To debug, I set a breakpoint
> immediately after the "DO FORM" and put TYPE("pScreen") into the watch
> window. I set a breakpoint on the watch for when TYPE("pScreen")
> changes. Without any other program code changes, the application runs
> fine and the variable never becomes undefined (until I want it to be
> undefined)!!! I follow the exact same keystrokes/mouse clicks when
> running in debug mode with the watch as without.
>
> Any ideas of why the variable becomes undefined somewhere in the code
> but not when a watch/breakpoint is set?
>



Re: VFP 8.0 losing memory variables by Mark

Mark
Fri Jan 12 10:54:21 CST 2007


Carsten Bonde wrote:
> Mark,
>
> another idea.
> Do you have a "PRIVATE ALL" statement somewhere in you code? The statement
> hides all variables.
>
> Try this, to see what i mean:
>
> TEST.PRG
> PUBLIC pScreen AS String
> pScreen= "Hello"
> ? type("pScreen")
> Foo()
>
> PROCEDURE Foo
> PRIVATE ALL
> ? type("pScreen")
> ENDPROC
>
> --
> Cheers
> Carsten
> _______________________________
>
> "Mark" <mminnie@minniebyte.com> schrieb im Newsbeitrag
> news:1168544886.795187.144460@i39g2000hsf.googlegroups.com...
> >I have a very large application that seems to be losing a public object
> > variable at run-time. I create define a public variable "pScreen",
> > initialize the variable with a blank string and then issue a command
> > such to create a form linking the variable to the screen. Such as:
> >
> > PUBLIC pScreen
> > pScreen = ""
> > DO FORM SomeScreen NAME pScreen LINKED NOSHOW
> > ......
> >
> > Somewhere in the code the variable is undefined (ie. TYPE("pScreen")=
> > "U"). I know this because when a code tries to reference the pScreen
> > variable, an exception is thrown. To debug, I set a breakpoint
> > immediately after the "DO FORM" and put TYPE("pScreen") into the watch
> > window. I set a breakpoint on the watch for when TYPE("pScreen")
> > changes. Without any other program code changes, the application runs
> > fine and the variable never becomes undefined (until I want it to be
> > undefined)!!! I follow the exact same keystrokes/mouse clicks when
> > running in debug mode with the watch as without.
> >
> > Any ideas of why the variable becomes undefined somewhere in the code
> > but not when a watch/breakpoint is set?
> >

I DO NOT have a PRIVATE ALL statement in any of my code. I do have
some CLEAR ALL and RELEASE ALL statements, but these are NOT being
executed between the time the pScreen is created and when I get my
error for pScreen being undefined. I have check for all references to
pScreen and nowhere is it released prematurely.

I have run and re-run the program with and without a breakpoint. Each
time I used the same exact mouse clicks and keystrokes. The time this
error comes up (pScreen is undefined) is when I DO NOT set a breakpoint
to check the value of pScreen. When I do set a breakpoint, pScreen
stays defined. This is FRUSTRATING!


Re: VFP 8.0 losing memory variables by Thomas

Thomas
Sat Jan 13 05:36:56 CST 2007

Mark schrieb:
> Carsten Bonde wrote:
>
>>Mark,
>>
>>another idea.
>>Do you have a "PRIVATE ALL" statement somewhere in you code? The statement
>>hides all variables.
>>
>>Try this, to see what i mean:
>>
>>TEST.PRG
>>PUBLIC pScreen AS String
>>pScreen= "Hello"
>>? type("pScreen")
>>Foo()
>>
>>PROCEDURE Foo
>>PRIVATE ALL
>> ? type("pScreen")
>>ENDPROC
>>
>>--
>>Cheers
>>Carsten
>>_______________________________
>>
>>"Mark" <mminnie@minniebyte.com> schrieb im Newsbeitrag
>>news:1168544886.795187.144460@i39g2000hsf.googlegroups.com...
>>
>>>I have a very large application that seems to be losing a public object
>>>variable at run-time. I create define a public variable "pScreen",
>>>initialize the variable with a blank string and then issue a command
>>>such to create a form linking the variable to the screen. Such as:
>>>
>>>PUBLIC pScreen
>>>pScreen = ""
>>>DO FORM SomeScreen NAME pScreen LINKED NOSHOW
>>>......
>>>
>>>Somewhere in the code the variable is undefined (ie. TYPE("pScreen")=
>>>"U"). I know this because when a code tries to reference the pScreen
>>>variable, an exception is thrown. To debug, I set a breakpoint
>>>immediately after the "DO FORM" and put TYPE("pScreen") into the watch
>>>window. I set a breakpoint on the watch for when TYPE("pScreen")
>>>changes. Without any other program code changes, the application runs
>>>fine and the variable never becomes undefined (until I want it to be
>>>undefined)!!! I follow the exact same keystrokes/mouse clicks when
>>>running in debug mode with the watch as without.
>>>
>>>Any ideas of why the variable becomes undefined somewhere in the code
>>>but not when a watch/breakpoint is set?
>>>
>
>
> I DO NOT have a PRIVATE ALL statement in any of my code. I do have
> some CLEAR ALL and RELEASE ALL statements, but these are NOT being
> executed between the time the pScreen is created and when I get my
> error for pScreen being undefined. I have check for all references to
> pScreen and nowhere is it released prematurely.
>
> I have run and re-run the program with and without a breakpoint. Each
> time I used the same exact mouse clicks and keystrokes. The time this
> error comes up (pScreen is undefined) is when I DO NOT set a breakpoint
> to check the value of pScreen. When I do set a breakpoint, pScreen
> stays defined. This is FRUSTRATING!
>
passing a memvar by reference hides the original name and only allows
access via the name specified to receive the parameter.

HTH

thomas

Re: VFP 8.0 losing memory variables by Imaginecorp

Imaginecorp
Sat Jan 13 11:05:48 CST 2007

Hello Mark;
If the form closes, because of "Linked" Type("pScreen") will return a "U" as
the object (Form) has been released. pScreen still exists as its declared
Public. A work around would be:
***forms INIT()
Public pScreen
pScreen = this
***Forms Destroy()
Release pScreen extended

Now you can access pScreen fro anywhere as long as the form is open
The problem here is when the same form is opened multiple times...VFP gets
confused. But there are workarounds.
If you let us know what exactly you are trying to do, there are otherways to
reference a forms methods etc when it is opened, It will be easier to
suggest alternate ways
--
Mohammed
www.imaginecorp.com/what_we_do.htm

"Mark" <mminnie@minniebyte.com> wrote in message
news:1168544886.795187.144460@i39g2000hsf.googlegroups.com...
>I have a very large application that seems to be losing a public object
> variable at run-time. I create define a public variable "pScreen",
> initialize the variable with a blank string and then issue a command
> such to create a form linking the variable to the screen. Such as:
>
> PUBLIC pScreen
> pScreen = ""
> DO FORM SomeScreen NAME pScreen LINKED NOSHOW
> ......
>
> Somewhere in the code the variable is undefined (ie. TYPE("pScreen")=
> "U"). I know this because when a code tries to reference the pScreen
> variable, an exception is thrown. To debug, I set a breakpoint
> immediately after the "DO FORM" and put TYPE("pScreen") into the watch
> window. I set a breakpoint on the watch for when TYPE("pScreen")
> changes. Without any other program code changes, the application runs
> fine and the variable never becomes undefined (until I want it to be
> undefined)!!! I follow the exact same keystrokes/mouse clicks when
> running in debug mode with the watch as without.
>
> Any ideas of why the variable becomes undefined somewhere in the code
> but not when a watch/breakpoint is set?
>