Using Default Values
Prior to Release 20,
Pro/TOOLKIT applications implemented default values by checking for a user-entered carriage return. Beginning with Release 20, you can specify default values within the call to
ProMessageDisplay(), provided that the separator ||| appears in the format string in the message file. (See the section
Contents of the Message File for the specific placement of the ||| separator.)
|
Note:
|
You must call the function ProMessageDisplay() before calling the ProMessage*Read functions to specify the default values.
|
Default values are displayed in the text box as input. Note that this value will not be passed to the Creo TOOLKIT function if the user hits a carriage return; instead, the function will return PRO_TK_GENERAL_ERROR and the application must interpret that the user intends to use the default.
To specify a constant default value, the format string would appear as follows:
Enter a double: |||3.0
Specifying constant defaults is not recommended as changing the default requires revising the Creo TOOLKIT application. Specifying defaults that are variables is more flexible.
To specify a default integer that is a variable, for example, the format string in the message file would appear as follows:
Enter any integer: |||%0d
Example 2: Displaying Messages and Retrieving Keyboard Input
The sample code in UgMessageWindowUse.c located at <creo_toolkit_loadpoint>/protk_appls/pt_userguide/ptu_message shows how to print messages and accept keyboard input with default values. The example also shows how to write a message to an internal, wide-string buffer. The name of the message file is msg_ugmessage.txt.