6 |
The LA Fox Developer Newsletter
April 1997
Using VFP 5.0 Grids
by Mike Vincent
President, OC Fox
I’ve been doing a lot of work with grids lately, so I’ll devote this
month’s column to talking about using grids in VFP 5.0. When
Visual FoxPro was introduced, the grid was in my opinion the
most significant new control. It was a quantum jump from the
old 2.x Browse. In VFP 5
it
has been further refined. Like most
complex tools, using the grid effectively takes a little practice
and experience.
Grid
Basics
101
The Grid is a container object that can display multiple rows of
a view, cursor, or table. The Grid object allows you to present
and manipulate rows and columns of data in a form or page. It is
commonly used to display the many side of a one-to many
relationship. A grid can contain columns and the columns
contain headers and controls, each with their own sets of
properties, events, and methods, giving you a great deal of
control over the elements of the grid. Controls can be textbox,
combobox, Iistbox, checkbox, spinner, command button, or
another grid but can’t be a timer.
To begin working with grids, you need to bind data to your grid.
Set the Record Source property (Data tab) to the name of the
alias or table that will be used with the grid. Then set the
RecordSourceType property. Use 0-Table, if you want Visual
FoxPro to open the table for you, or 1
-
Alias if you want the grid
to be populated with the fields in a table or view that is already
open.
The default control in a column is a textbox. To use a different
control, drag it from the controls toolbar into the column. Check
the order by checking the controls in the drop down list at the
top of your Properties form. The new control should appear
under a column below the header and the default Texti control.
Make the new control active by setting the column’s
CurrentControl property in the Data tab.
If you leave the ColumnCount property (Layout tab) set to -1, all
columns in the bound table will be included in your grid. To gain
a little more control, set the ColumnCount to a value appropriate
for your data and set the DataSource for each column to display
particular fields in particular columns. You should then size
each column for the data it will contain.
I always set DeleteMarks to False since these are dangerous
and confusing to end users. I also turn off (set to False)
AllowHeaderSizing, AllowRowSizing and SplitBar to prevent
users from creating variations of grids that I never intended.
Want to prevent users from moving or resizing columns? Set the
ColumnX.Movable and ColumnX.Resizable properties to False.
Depending on your requirements, the ScrollBars property can
be set to 0 (None), I (Horizontal), 2 (Vertical), or 3 (Both).
(Con’t, page 7)
Just In Case You Forgot
Membership Dues
It’s time to start thinking about membership dues again. Last
year, we implemented a new payment policy that brought
everyon current in a matter of months. Here’s how it works:
Look at your mailing label on the back of the newsletter. If your
membership expired in the first three months (January thru
March) of 1996, your name will be eliminated from the newslet-
ter mailing list in January, 1997; if your membership expired in
the second three months (April thru June) of 1996, your name
will be eliminated from the newsletter mailing list in February,
1997; if your membership expired in the third three months (July
thru September) of 1996, your name will be eliminated from the
mailing list in March, 1997; and if your membership expires in
the last three months (October thru December) of 1996, your
name will be eliminated from the mailing list in April, 1997.
Last year, using this type of methodology and an “amnesty”
program, we were able to bring memberships current that had
expired back in 1993. So virtually everyone that is now a
member of LA Fox has an expiration date of 1996 or 1997. This
helps us out a lot since we are a totally self-supported group
and membership helps defray the costs of newsletters, the
meeting room, guest speakers, etc.
There are several advantages to membership the
cominaraderie and networking capabilities of me group, the
chance to see and hear speakers that you would have to spend
hundreds of dollars to see elsewhere, a monthly ten-page
newsletter, the LA FoxCast, etc.
So everyone make sure you look at your mailing label for your
membership expiration date and please respond accordingly.
Membership dues are $45, payable to LA Fox, and can be
mailed to Twila Miller, 1601 North Sepulveda Blvd.
-
#191,
Manhattan Beach, CA 90266, or brought to the next meeting.
If you’re the slightest bit “local” to the Southern California area
and plan on attending the conference, please
do not plan on
“pre-registering” the first
day of the conference at least
if you want to receive the conference materials or eat (some-
thing that’s still important). We need to commit actual numbers
to the hotel
two
weeks prior to the conference so that food for
conference meals can be allocated, as well as the collateral
materials that will be handed to you as you register. So if you’re
local, don’t put it off
register now.
Important Spring
Conference Announcement
Page 6
|
6 |