Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

GETCP()

The GETCP() function calls up a dialog that allows the operator to pick a code page.

Usage

nCodePage = GETCP( [ nInitialCP [, cPrompt [, cTitle ] ] ] )

Parameter

Value

Meaning

nInitialCP

Integer

Displays the specified code page as selected in the list box. You must pass some value (even though it doesn't need to be a valid code page) if you pass a value for cPrompt or cTitle.

Omitted

No code page is highlighted.

cPrompt

Character

The prompt to appear within the dialog box. Practically limited to around 200 characters, but more are accepted.

Empty string or omitted

Prompt is "Please select a code page for cross-platform data sharing." Note that you must pass the empty string, and not just omit the parameter, if you pass the cTitle parameter.

cTitle

Character

The title to display in the dialog box title bar. If the title exceeds the space allowed, it is truncated with an ellipsis.

Empty string or omitted

Dialog title is displayed as "Code Page."

nCodePage

0

User selected Cancel, Close from the control menu or pressed Escape.

Integer

The code page selected by the user.

Use this dialog to allow your users to chose a code page for tagging a file, translating, or perhaps selecting which code page to use for generation. There appears to be no way to preset the option group on the left-hand side of the dialog to show anything but “All platforms.” Check out the CpZero.PRG supplied with Visual FoxPro to modify the code page of an existing DBF.

Example

? GETCP( 1250, "Convert file to which code page?", ;
               "Code Page Conversion" )

See Also

CPConvert(), Set CPDialog