FoxPro for Macintosh Power Tool Tips and Tricks

ID: Q120368

The information in this article applies to:

SUMMARY

This information is also available in FoxPro's online help system.

To go directly to this topic, choose the "Tips and Tricks" help topic. Then do one of the following, depending on which online Help file is in use:

MORE INFORMATION

Invisible Buttons in Screens

Invisible buttons are a type of push button and can be created using the push button tool in the Screen Builder toolbox.

Pictures Buttons in Screens

You can create picture screen controls such as push buttons, check boxes and radio buttons using the SHOW GET command. In addition, you can specify a separate picture file for each of the three states in which a control can exist (enabled, selected, disable) as shown in this example:

   SHOW GET mybtn,7  PROMPT ;
      'EXITEN.PCT,EXITSEL.PCT,EXITDIS.PCT

Picture Files for Screen Controls

When using picture files in a set of controls, try to use picture files that are the same size. You should also use picture files that have a white (distinguishing) background so that when you disable them, they will have a well defined outline. Try to use a picture files that is slightly smaller than the overall control because extra border space is added automatically.

Spinner Limits

When creating spinners, remember that the minimum and maximum settings do not stop a user from typing in any value they desire. You must specify range values to limit the values that users can type.

Override Snap to Grid

The Snap To Grid option in the Screen Builder allows you to align objects to a grid defined in the Ruler/Grid dialog. To override the Snap To Grid setting, hold down the CTRL key when moving an object. If you are not sure whether objects are aligned, use the line tool to create a temporary line for alignment purposes. Also, you can use the Show Position menu option to display the exact coordinates of an object in the status bar.

Single Platform Screens

If you are generating screens for use in FoxPro for Macintosh only, make sure you have the Macintosh Objects Only option checked in the Generate Screen dialog. This will reduce the amount of code generated and the time it takes to generate code.

Transparent/Opaque Screen Objects

The Screen Builder allows you to apply a Mode attribute to certain objects such as text. The Mode attribute can be opaque or transparent. A text object's fill colors only appear if the object is opaque. Avoid using a transparent mode on @...SAY commands which are refreshed with different text. This will cause the old text to be overwritten on top by the new text.

Since new objects can overwrite old objects, you may not see the desired effect when creating transparent objects that toggle between enabled and disabled states. You can, however, attain some interesting and desired special effects using a transparent mode. For example, a disabled control such as a check box dims the text prompt as well as the box portion of the control. You can make the text prompt appear enabled even though the check box is actually disabled. You simply need to ENABLE and then DISABLE the control using the SHOW GET command.

Read-Only Edit Regions in Screens

The @...EDIT command is used to create edit regions for memo fields on screens. The Screen Builder does not have an option to make these read-only. You can create a work around solution by defining the WHEN clause of the edit region as an expression and typing in the following code:

   .T. NOMODIFY

Quick Screen

If you create a Quick Screen and you specify a column layout but only get one column, one or more of your fields may be too wide for multiple columns. Adjust the maximum field width in the Quick Screen dialog and try again.

Templates for Screens and Reports

If you usually use settings in the Screen Builder or Report Writer that are not the default (ruler settings, show position, and so on.), consider creating a template with your custom settings and using the template as the base for new screens or reports.

Circles in Screens and Reports

To create a circle (oval) in the Screen Builder or Report Writer, use the rounded-rectangle tool to create the object, then double-click on it and select the round button.

Size Report and Screen Fields

To easily size fields one character at a time, use FONTMETRIC(7) to determine the maximum character width for the font you're using, then set the horizontal grid to the maximum character width. When you size fields, they will move one "character" at a time.

Drawing Multiple Objects in Screens and Reports

In the Screen Builder and Report Writer, after you select a tool from the toolbox and draw an object, the selection pointer becomes the active tool. To keep another tool active when drawing multiple objects of the same type, double-click the tool. It will appear darkened when it is selected in this manner.

Placing Objects in Screens and Reports

In FoxPro for Macintosh, the keyboard is the best device to use to precisely place objects. When an object is selected, you can use the arrow keys to move it 1 pixel at a time. Holding down the Shift key while you use the arrow keys will resize the object.

Multi-Line Text Objects

You can create multi-line text objects in the Screen Builder and Report Writer by pressing Enter to continue typing on the next line. You are limited to 255 characters per text object.

Redo Quick Screen/Report/Menu

To redo a Quick Screen, Report or Menu, delete all of the objects and choose the Quick Screen/Report/Menu option again.

Multi-Column Snaking Reports

Because FoxPro for Macintosh uses the same format for labels as it does for reports, you can create multi-column snaking reports. In fact, the .FRX and .LBX files are identical, and the REPORT FORM and LABEL FORM commands are interchangeable.

AS Clause in RQBE

RQBE does not have a built-in way to create an AS clause to rename an output column. To create an AS clause in RQBE, open the RQBE Select Fields dialog and type the field name followed by the AS name in the Functions/Expression box. This is especially handy when using a function:

   COUNT(people.name) AS 'Employees'

NOTE: When FoxPro reopens a .QPR file, it will ignore the AS clause. It still exists in the file until you save over it. This trick can be quite useful with on-the-fly queries which don't need to be saved.

Additional reference words: FoxMac 2.50b 2.50c on-line KBCategory: kbusage KBSubcategory:

Last Reviewed: May 29, 1996