FoxPro for Windows Interface Tips and Tricks

ID: Q117569


The information in this article applies to:


SUMMARY

This information is also available in FoxPro's online Help files.

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

Font Considerations

When designing applications that will be used in 1024x768 (not small font) video resolution, keep in mind that FoxFont is only a small font. This means that as other fonts are expanded to appear larger in that mode, FoxFont stays the same. This may cause problems in applications that have multiple windows on the screen at the same time, or applications that use specific placement of bitmaps. For this reason, FoxFont should not be used as the base font when defining these application windows. Instead, use a common font that is supplied with Windows:

  1. Set the font of the main FoxPro window to a standard Windows font such as MS Sans Serif 8.

    (NOTE: This information in the online Help file incorrectly suggests the use of MS Sans Serif 10.)


  2. Define, generate and position your application's windows while using this font.


  3. Set the font of the main FoxPro window to your chosen font at the start of your application (or in the startup code snippet). Remember to set it back to its initial value at the end of your application (or in the cleanup code snippet).


Available Font

To find out if the font you want to use is available, use AFONT().

Mono-Spaced and Proportional Fonts

The FONTMETRIC() function is useful in determining whether a font is mono- or proportionally-spaced. If FONT(6) = FONT(7), then the font is mono-spaced.

Text Editor

To select an entire line of text (including the carriage return) when editing, triple-click on the line.

To move or copy selected text, use "drag-and-drop". You can drag a copy of the text by holding down the Ctrl key as you drag the selected text. When you use drag and drop, FoxPro places the dragged text on the clipboard. Anything on the clipboard when you use drag and drop is overwritten.

To indent and unindent large sections of code or text, use Indent and Undent on the Text menu.

Color in Pictures

If the colors of a picture you are displaying do not look as expected, try using SET PALETTE OFF to display the picture using the color palette it was created with instead of FoxPro's default color palette. Chances are that a different color palette was used when the picture was originally created. But note that it does affect all pictures displayed.

Bitmaps/Wallpaper

When using a bitmap as wallpaper, try to use bitmaps that look good on screens of various sizes. If an application must use a wallpaper that requires objects to be in a specific location (for example, a button must always be on Bobo's nose), use the following steps:

  1. Create one bitmap scaled for 1024x768 large fonts.(BOBO.LRG)


  2. Create another bitmap scaled for all others.(BOBO.SML)


  3. At the beginning of the application, check FONTMETRIC(1) to see if small or large fonts are loaded. For example, FONTMETRIC(1,'MS SANS SERIF',8) always returns 13 if small fonts are loaded and 16 for large fonts.


  4. Copy the appropriate bitmap file to the one used for the wallpaper. (for example, BOBO.SML => BOBO.BMP)


Customizing the Main FoxPro Window

You can modify the main FoxPro window using the MODIFY WINDOW SCREEN command. This command allows you to set various attributes of the window including font, font size, font style, wallpaper, color, icon file, title, size, and so on. You can also use the ZOOM WINDOW SCREEN command to maximize and minimize the main FoxPro window.

The MODIFY WINDOW SCREEN command restores the main FoxPro window to the size it was when FoxPro for Windows was launched. This size is stored in the FOXPRO.INI file and is saved when you exit FoxPro.

The ZOOM WINDOW SCREEN NORM command restores the FoxPro window to the size it was before you used a ZOOM WINDOW SCREEN MAX or ZOOM WINDOW SCREEN MIN command.

Notice that you can issue multiple MODIFY WINDOW commands to adjust different characteristics of a window without changing characteristics that you've already set.

To change the font of the main FoxPro window, hold down the Shift key and choose Screen Font... from the Text menu. You can also change the font with the MODIFY WINDOW SCREEN command.

With the Screen Builder, you can create a DESKTOP window in the Window Style dialog. This option allows you to customize the main FoxPro window.

Icon Placement

To place a minimized window icon in a specific location, try this:

   DEFINE WINDOW x FROM 10,10 TO 20,20 MINIMIZE FLOAT CLOSE
   ACTIVATE WINDOW x NOSHOW
   ZOOM WINDOW x MIN
   MOVE WINDOW x TO 1,1
   SHOW WINDOW x 

Right Mouse Button

You can set your right mouse button to emulate the Enter key by using ON KEY LABEL RIGHTMOUSE KEYBOARD CHR(13). Now, you can press the right mouse button instead of the Enter key to execute commands, select items, and so on.

Closing Multiple Windows

To close several windows at one time, hold down the Shift key and choose Close All from the File menu. You can temporarily hide all windows by simultaneously pressing SHIFT+CTRL+ALT.

Password Protection

If your application requires a password, try using a font size that is too small to read or a password font in which all the characters are the same.

Frontmost Window

You can create windows which can exist outside the main FoxPro window using the IN DESKTOP clause. These windows look like normal FoxPro windows but behave differently.

An IN DESKTOP window always remains in front of any other window, even if you open another window later. WONTOP() will always return the IN DESKTOP window. This is especially important in event-driven programs. IN DESKTOP can also be used to simulate a "floating palette" which always stays on top of the active window. Floating palettes are common in Microsoft Windows and Macintosh software products.

The location of IN DESKTOP windows is determined by the Microsoft Windows coordinate system. Normal user-defined windows use FoxPro's coordinate system.

Additional query words: FoxWin on-line


Keywords          : FxtoolSbuilder 
Version           : 2.60
Platform          : WINDOWS 
Issue type        : 

Last Reviewed: August 8, 1999