1 |
The LA Fox Developer
A Newsletter for
FoxPro
Application Developers in Southern California
June 1997
VFP Forms for Any
Screen Resolution
By Nelson M. Johnson,
CCP
While
I was learning MS Access, I saw a really cool demonstra-
tion of
a
form that would proportionally resize all the controls on
the form each time the form size was changed so that no matter
how small or large the form was, the user could still use all the
controls. I was stunned. This was the answer to my Windows-
client prayers. Now I could develop a form for one resolution
and regardless of what screen resolution the user had, my form
would always look right. I initially tried copying the code into the
forms I wanted to have this ability, but reality struck. Access
has this nasty requirement that ALL procedure names through-
out the application must be unique. This meant that if I really
wanted this to work, I would have to do some serious re-writing.
Along comes Visual FoxPro. I wrote a simplified procedure to
do this very trick and have included it below. There are four
properties you will need to add to your form: PrevHeight,
PrevWidth, BaseWidth, and BaseFontSize. You should manu-
ally set the BaseFontSize to whatever font size is your default
for the form. Then add these two procedures to your form and
you are off. There are a couple things you need to be aware of:
This will not handle container objects such as option groups and
page frames. Also, some controls have an AutoSize property
which this will set to .T., but the ones that don’t (like text boxes)
will have problems in the handling of the height property be-
cause rounding error will cause the size to “creep” if you resize
the form several times. I started to address this problem in fonts
by tracking the original base font size and then use an absolute
scaling factor, but I haven’t perfected it
-
I will leave that to you
to share with us. Unlike its Access cousin, this code should
allow you to drop it into many forms or classes and impress
your clients and coworkers, especially if they have been using
an FPW application.
Procedure Form.lnIt()
this.prevHeight
=
this.height
thls.prevWldth
=
thls.wldth
this.BaseWldth
=
thls.wldth
Procedure Form.Resize()
local
Inl && a loop counter
local lcName && the name of the object
(Con't,
page
7)
In this issue
At LA Fox
June 16, 1997, 7:30 PM
-
Mike Meer. Mike is the Vice Presi-
dent of Microcomputer Engineering Services, LLC, a company
specializing in highly-customized, mission-critical applications
for such diverse clients as Fox Broadcasting and the State of
Nevada. This night, he will be discussing builders, builderb (by
Ken Levy), and other tricks to help you develop VFP screens/
applications quicker. He will breakdown the process of selecting
and modifying objects during development. If time permits, he
will also show how this knowledge can translate to on-the-fly
adding of objects during runtime. Code examples will be avail-
able after the meeting on the LA Fox Website.
July
21, 1997,
7:30 PM
-
Miriam Liskin. Miriam is extremely
well-known for her contributions to the FoxPro community. She
writes a regular column for FoxPro Advisor and has authored
many books on the subject of FoxPro application development.
Her most recent books are Miriam Liskin’s Visual FoxPro
Expert Solutions (Que) and PC Magazine Programming FoxPro
2.5 (Ziff-Davis). Topic: An introduction to two basic strategies
for publishing FoxPro data on the Internet. The first involves
using FoxPro programs to generate static HTML pages,
which can then be placed on any Internet server. The second
involves using third-party tools to facilitate dynamic access to
FoxPro data. She’ll talk about the advantages and disadvan-
tages of these two approaches and suggest some strategies for
overcoming the Iimitatipns of currently available tools.
Since We Last Met....
For those of you who missed him, Drew Speedie provided an
(Con't page 2
)
____
Out and About
by Barry R. Lee
The June meeting of LA Fox will be held on
June 16, 1996, at 7:30 PM at our regular
meeting place (the Torrance Airport, 3301
Airport Drive, in Torrance). For details on
how to get there, see the map on the back
page.
Lead, Follow...
Page 3
Ken Levy’s CIassX Seminar
Page 4
KeyPress Event Parameters
Page 8
and much more!
|
1 |