DisplayValue

GetPict()

This function brings up a special version of the File-Open dialog designed to let you choose graphic files. Read the name as "Get Picture."

Usage

cPictureFile = GETPICT( [ cExtension [, cPrompt                          [, cOpenCaption ] ] ] )

Parameter

Value

Meaning

cExtension

Character

A semicolon-delimited (;) or vertical bar-delimited (|) list of file extensions to display in the Open Picture dialog. Can include DOS wildcards. As with GETFILE(), each extension type is shown separately in the drop-down. The first one you list is the drop-down value when the dialog opens. While you're not restricted to graphic types, attempting to preview a file that isn't of one of the supported graphic formats displays the message "Preview not available" in the preview box. (That's actually acceptable behavior, in our view. Sure beats an error message.)

Omitted

In VFP 6 and later versions, show all supported graphics files. In VFP 3 and VFP 5, show bitmap and icon files. Lets you see them all at once or one category at a time. Note that some popular graphic formats (including TIF) are still not supported.

cPrompt

Character

The prompt to put next to the text box for the filename. (In VFP 3, the prompt goes over the file list.)

Omitted

The prompt is "File Name:"

cOpenCaption

Character

The caption to appear on the first ("OK") button.

Omitted

The button says "OK".

cPictureFile

Character

The fully qualified name of the selected file.

Empty

The user exited the dialog without choosing a file.


There's nothing about this dialog that forces the user to choose a picture. It's just set up to make it easier to choose pictures. As with other Windows Open dialogs, the user can change the extension or choose from "All Files." Check the files returned to make sure they're the type you expect (or at least have the right extension).

In VFP 6, they fixed our biggest complaint about this function. In FoxPro 2.x, the dialog you used to choose a picture had an "automatic preview" capability. If you paused on a filename more than briefly, the picture appeared in the Preview window. In VFP 3 and VFP 5, to preview a picture, you had to push a button. Starting in VFP 6, they finally got it right. The dialog has a check box that lets you decide whether or not to show a preview. The preview seems to be quite fast, too—no waiting around until FoxPro feels like showing you the picture.


Another improvement is that the preview (and FoxPro itself) can handle a myriad of graphic types. In older versions, it was limited to bitmaps and icons.

Example

* Let the user choose an icon for the current form cIcon = GETPICT("ICO","Choose an icon") IF NOT EMPTY(cIcon) AND RIGHT(cIcon,3)="ICO"    This.Icon = cIcon ENDIF

See Also

DisabledPicture, DownPicture, GetFile(), Icon, Picture


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net