How do I use global variables in VFP6? 
Author Message
 How do I use global variables in VFP6?

I have a formset in which I need various controls on the various forms
to communicate with each other.  I want to be able to do this with
global variables, but I am unsure as to how to do this.  Right now I am
storing the values of these "global" values in hidden textboxes, but
this seems awkward as there are several global variables that need to be
referenced.


Thu, 18 Jul 2002 03:00:00 GMT  
 How do I use global variables in VFP6?

Quote:
>I have a formset in which I need various controls on the various forms
>to communicate with each other.

In the forms menu, create new propery allows you to give the form a new
property, which you can use as a global variable.

You can also use the command

PUBLIC myvar

to declare a memory variable as a global variable.
David B. Cass
U.S. Navy, FISC Norfolk, VA



Thu, 18 Jul 2002 03:00:00 GMT  
 How do I use global variables in VFP6?
Hi,

Make these variables properties of the Formset.

Best regards,
Tom

Quote:

> I have a formset in which I need various controls on the various forms
> to communicate with each other.  I want to be able to do this with
> global variables, but I am unsure as to how to do this.  Right now I am
> storing the values of these "global" values in hidden textboxes, but
> this seems awkward as there are several global variables that need to be
> referenced.



Thu, 18 Jul 2002 03:00:00 GMT  
 How do I use global variables in VFP6?
Don't use PUBLIC variables. Add new properties to the formset. All the forms
in the formset will have access to them.

--

Craig Berntson
MCP, Microsoft FoxPro MVP
Salt Lake City Fox User Group
http://members.home.com/foxpro

Quote:

> I have a formset in which I need various controls on the various forms
> to communicate with each other.  I want to be able to do this with
> global variables, but I am unsure as to how to do this.  Right now I am
> storing the values of these "global" values in hidden textboxes, but
> this seems awkward as there are several global variables that need to be
> referenced.



Fri, 19 Jul 2002 03:00:00 GMT  
 How do I use global variables in VFP6?
Here's what's worked well for me...
Create a table to store global settings. Add this table to each form's data
environment.  You can store up to 254 settings/variables in each record.
Multi-user apps can provide a seperate record for each user. This table can
be used to store and retrieve globally accessable values AND
user-preferences.

--
Brett Slattery

Quote:

> I have a formset in which I need various controls on the various forms
> to communicate with each other.  I want to be able to do this with
> global variables, but I am unsure as to how to do this.  Right now I am
> storing the values of these "global" values in hidden textboxes, but
> this seems awkward as there are several global variables that need to be
> referenced.



Fri, 19 Jul 2002 03:00:00 GMT  
 How do I use global variables in VFP6?
Why not? What is the downside to using public variables? Is it a performace
issue? reliability?
Quote:

> Don't use PUBLIC variables. Add new properties to the formset. All the forms
> in the formset will have access to them.

> --

> Craig Berntson
> MCP, Microsoft FoxPro MVP
> Salt Lake City Fox User Group
> http://members.home.com/foxpro


> > I have a formset in which I need various controls on the various forms
> > to communicate with each other.  I want to be able to do this with
> > global variables, but I am unsure as to how to do this.  Right now I am
> > storing the values of these "global" values in hidden textboxes, but
> > this seems awkward as there are several global variables that need to be
> > referenced.



Fri, 19 Jul 2002 03:00:00 GMT  
 How do I use global variables in VFP6?
The downside to PUBLIC variables is that it is far too easy to change their
value from another piece of code, and probably by accident.  It makes it
very difficult to track down problems.

Properties are much nicer to deal with as they're "encapsulated" to the
forms that need them.  No danger of accidently wiping out or changing the
value from some other code.  Plus when the forms that use them "go away", so
do it's properties.  Also not true of PUBLIC variables.  They remain around
until you leave FoxPro.

Fred

Quote:

>Why not? What is the downside to using public variables? Is it a performace
>issue? reliability?


>> Don't use PUBLIC variables. Add new properties to the formset. All the
forms
>> in the formset will have access to them.

>> --

>> Craig Berntson
>> MCP, Microsoft FoxPro MVP
>> Salt Lake City Fox User Group
>> http://members.home.com/foxpro




- Show quoted text -

Quote:
>> > I have a formset in which I need various controls on the various forms
>> > to communicate with each other.  I want to be able to do this with
>> > global variables, but I am unsure as to how to do this.  Right now I am
>> > storing the values of these "global" values in hidden textboxes, but
>> > this seems awkward as there are several global variables that need to
be
>> > referenced.



Fri, 19 Jul 2002 03:00:00 GMT  
 How do I use global variables in VFP6?
Doesn't this do the same thing as declaring the variable as "public myVar"?
Doesn't it have the same downsides as in Craig Berntson's post?
Quote:

> Hi,

> Make these variables properties of the Formset.

> Best regards,
> Tom


> > I have a formset in which I need various controls on the various forms
> > to communicate with each other.  I want to be able to do this with
> > global variables, but I am unsure as to how to do this.  Right now I am
> > storing the values of these "global" values in hidden textboxes, but
> > this seems awkward as there are several global variables that need to be
> > referenced.



Fri, 19 Jul 2002 03:00:00 GMT  
 How do I use global variables in VFP6?
It's not necessarily an issue of downsides (although there are arguments to
be had for not using public variables), it's an issue of proper object
oriented programming, or poop, if you like acronyms. =P

--
William Fields
US Bankruptcy Court
Phoenix, AZ


Quote:
> Why not? What is the downside to using public variables? Is it a
performace
> issue? reliability?


> > Don't use PUBLIC variables. Add new properties to the formset. All the
forms
> > in the formset will have access to them.

> > --

> > Craig Berntson
> > MCP, Microsoft FoxPro MVP
> > Salt Lake City Fox User Group
> > http://members.home.com/foxpro




- Show quoted text -

Quote:
> > > I have a formset in which I need various controls on the various
forms
> > > to communicate with each other.  I want to be able to do this with
> > > global variables, but I am unsure as to how to do this.  Right now I
am
> > > storing the values of these "global" values in hidden textboxes, but
> > > this seems awkward as there are several global variables that need to
be
> > > referenced.



Fri, 19 Jul 2002 03:00:00 GMT  
 How do I use global variables in VFP6?
The benefit of formset properties in your case would be encapsulation and
polymorphism. This means that you could have multiple instances of your
formset running without each one stepping on the others "public" variables.
You may blindly say that you'll never need this capability, but if you get
in the habit, you'll save yourself time and energy in the long run because
you're using proper object oriented programming methodologies.

Another benefit that goes along with using object properties is the fact
that you can define access and assign methods that fire when the property
is read or written to. This is a very powerful feature.

--
William Fields
US Bankruptcy Court
Phoenix, AZ


Quote:
> Doesn't this do the same thing as declaring the variable as "public
myVar"?
> Doesn't it have the same downsides as in Craig Berntson's post?


> > Hi,

> > Make these variables properties of the Formset.

> > Best regards,
> > Tom




Quote:
> > > I have a formset in which I need various controls on the various
forms
> > > to communicate with each other.  I want to be able to do this with
> > > global variables, but I am unsure as to how to do this.  Right now I
am
> > > storing the values of these "global" values in hidden textboxes, but
> > > this seems awkward as there are several global variables that need to
be
> > > referenced.



Sat, 20 Jul 2002 03:00:00 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. Replacing global variables with global propeties?

2. using global variables as a value for a text box

3. Global variable -- a little help, please

4. local vs. global variables in readurl.com

5. Setting Global Environment-Variables for Exes in VFP 5.a SP3

6. Anyone done a VFP6 App for Terminal Server?

7. Using variable file name in VFP 5.0 using form wizards

8. I think I've done a silly thing VFP6

9. Error using cursor when selection criteria uses local variables

10. Plan Ahead If You Plan Doing Client / Server (Using VFP Graphical Design)

11. STUNNING: Does VFP6 loose private variables

12. Length of Variables in a VFP6 Report

 

 
Powered by phpBB® Forum Software