Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Boudewijn Lutgerink
  Where is Boudewijn Lutgerink?
 Hoonaardstraat, Driel
 Boudewijn Lutgerink
 To: Ken Murphy
  Where is Ken Murphy?
 Ken Murphy
Subject: RE: Changing the Fontname
Thread ID: 136002 Message ID: 136030 # Views: 32 # Ratings: 1
Version: Visual FoxPro 9 Category: Databases, Tables and SQL Server
Date: Monday, June 25, 2007 2:15:34 PM         

> Take a look at the "c" in front of "Name." When ever you see that "c" prefix, it is telling you that you need to give it a string. In other words, you need to enclose the value that you are using in quotes or square brackets:
> Object.FontName = [Some text font name] && use a real font name in the square brackets
> * or you could
> LOCAL lcFontName
> lcFontName = "My Font Name" && again, use a real font name
> Object.FontName = lcFontName

> You will find this to be true everywhere in the help file regardless of the command or function. If you see a "c" prefix, you need to enclose the value in square brackets or quotes (or use a character variable.)
> Ken
> You shall know the truth - and the truth shall set you free. (John 8:33)

Lebron, in addition to what Ken told you:
This IS an arbitrary approach about Hungarian notation, the discussion can go on forever.
As you can see in Ken's note he uses a variable, lcFontname. That is not an unusual notation in "VFP land".
The first character, the "l", says it is a local variable.
The second character, the "c" says it is a character string.
What follows, in CamelCase is the actual name of the variable.

as for the scope, there are basically two kinds of variables, local and public.
If named at the start of a code snippet they receive by default the .F. value.
as Ken did, LOCAL lcFontName, here lcFontName has a value of .F.
Then, if assigned, lcFontName = "My Font Name", the value is a string.
This DOES NOT protect you from overwriting it with another value.
VFP is not strong typed, so you could very well assign a new value to lcFontName like, lcFontName = 3.14567890 making it a numeric value.
The advantage of using this type of notation however is that the name itself tells you something about the kind of value it should have.

Do yourself a favor and try to use some sort of notation that explains on beforehand what kind of variable you work with.
I am now in a developer's nightmare, maintaining code that is developed by a company called "cut and paste".
Lots and lots of the same code in the application on a lot of places, and even worse, all the variables start with x...
So in this dreaded app I have a function with "some" variables like x1, x2, x3, x4...

A bit more on the scope of variables, before anybody attacks me with their wrath and anger.
The third kind we know about is the PRIVATE variable.
However, I do NOT use this because if you declare variables as private the variables receive NO value at all until assigned.


Boudewijn LutgeĀ®ink
When life hands you Lemons, ask for Tequila and Salt (and call me over!)