The Visual FoxPro Form Designer does not provide a menu choice to select
all objects and change the font. This capability was available in FoxPro
version 2.x for Windows.
You can create a builder that will change the font for all selected
objects. This article shows you how to do the same thing without writing
builder code by:
- Using the Command window.
- Using the ASELOBJ() function in a program.
Using the Command Window Only
To change the font for all objects on a form, perform the following steps:
- Design the form.
- Click the exclamation mark (!) icon on the toolbar to run the form.
- Switch to the Command window.
- Change the font of all objects in the running form by using the setall
method of the form. Enter the following command in the Command window,
where formname is the name of your form:
- Save the form back to a .scx file format by using the saveas method of
This method does have some limitations:
- All objects on the form are changed to the same font. You can use the
optional third parameter of the setall method to limit the change to
certain types of objects.
- The saveas method does not allow the form to be saved under the original
- If you want to change the font of selected objects only, you must write
a builder or set the properties for each individual object separately.
- Objects added after doing this procedure do not reflect the new font
Using the ASELOBJ() Function in a Program
The following program can form the basis of a builder. You can also run
this program from the Command window while in design mode of a form.
- Design the form, and select the objects.
- Create a .prg file that contains the following lines of code, and save
the program as Myfonts.prg:
lnNumOfControls = ASELOBJ(laFonts)
FOR ctr = 1 TO lnNumOfControls
.FontName = "Arial"
.FontSize = 12
.FontBold = .F.
- In the Command window, type this command:
This technique has the advantage of making changes directly in the form.
Article ID: 137945 - Last Review: February 24, 2014 - Revision: 1.1
- Microsoft Visual FoxPro 3.0 Standard Edition
|kbnosurvey kbarchive KB137945|