Dialog Operations
Functions Introduced
The function ProUIDialogCreate() loads a dialog from a resource file into memory. It can also create an empty dialog by passing a NULL value for the resource file name. The input arguments follow:
session_dialog_name—Name of the dialog.
resource—Name of the resource file.
The function ProUIDialogCreate() requires that the resource file name input matches the case of the actual resource file.
The dialog name specified in the resource file should match both the input argument resource and the name of the resource file without adding the suffix name.
The following points must be noted while developing Creo TOOLKIT applications:
Resource names of dialogs resources must not coincide with the resources that are defined by PTC.
Dialog instance or session names must not coincide with the instance or session names that are defined by PTC.
You can ensure uniqueness in the dialog resource and session names by adding a prefix that specifies the name of the Creo TOOLKIT application.
Use the function ProUIDialogActivate() to display the dialog on the screen and makes it active by setting the key input focus on it. This function returns only after the function ProUIDialogExit() has been called on the same dialog.
Use the function ProUIDialogComponentsCollect() to return the names of components in this dialog. This function can also filter components by their type.
*Refer to the topic UI Components for the predefined list of component types.
Use the function ProUIDialogMinimumsizeGet() to get the minimum size of the dialog in pixels.
Use the function ProUIDialogSizeGet() to get the size of the dialog.
Use the function ProUIDialogPositionReset() to reset the dialog in its previous screen position.
Use the function ProUIDialogReconfigure() to reset the size and position of the dialog.
Use the function ProUIDialogScreenpositionGet() get the screen position in pixels of the dialog component.
Use the function ProUIDialogAboveactivewindowGet() to checks if the dialog is always going to be above the dialogs currently active in the window.
Use the function ProUIDialogAboveactivewindowSet() to set focus of the dialog above any dialog in the currently active window.
*Using the ProUIDialogAboveactivewindowSet() allows Creo TOOLKIT applications to always stay in focus in the window during opening and closing events of .
Use the ProUIDialogDestroy() to remove the dialog instance from memory as it is not automatically removed.
Use the function ProUIDialogShow() to show a secondary window when the primary window is being restored.
Use the function ProUIDialogHide() to iconify a secondary window when the primary window is being minimized.
Use the function ProUIDialogExit() to terminate the activation of the named dialog window. The function causes a return from the call to ProUIDialogActivate() that make it active.
Use the function ProUIDialogDestroy() to remove the dialog from the memory.
You can set a timer to schedule an action to be executed later in session. The function ProUITimerCreate() creates a timer and registers the action. If you call the function ProUITimerCreate() with timer_name that already exists in the session, it returns an error. The input arguments for the function are:
action—Specifies call to the action callback function ProUITimerAction(). You can invoke the action callback only once from the function ProUIDialogTimerStart(). To run the action again, you must call ProUIDialogTimerStart() again.
appdata—Specifies the data that will be passed to the action callback.
timer_name—Specifies the name of the timer.
The function returns the ID of the timer, which will be used to start and stop the timer.
Use the function ProUIDialogTimerStart() to start the timer. The action is executed after the specified interval of time. The input arguments are:
dialog—Specifies the name of the dialog box. You can invoke only one timer at a time for a dialog box.
timer_id—Specifies the ID of the timer, which was returned by the function ProUITimerCreate().
duration—Specifies the time interval in milliseconds after which the action must be executed. The minimum value is set to 500 milliseconds.
write_in_trail_file—Specifies if the timer action must be recorded in a trail file.
The function ProUIDialogTimerStop() stops the timer and the action will not be executed. Specify the ID of the timer as the input argument.
The function ProUITimerDestroy() removes the specified timer, which was created using the function ProUITimerCreate(). If the timer to be removed has already been started, it is first stopped, and then removed. Pass the ID of the timer as the input argument. After the timer is removed, its name is available for use again. You can specify the name to a new timer.
*You must use the functions ProUITimerCreate(), ProUIDialogTimerStart(), ProUIDialogTimerStop(), and ProUITimerDestroy() only in DLL mode.
The function ProUIDialogMenupaneAdd() allows to create a menupane. After creating a menupane, you can add it to a cascade button in the menubar by using the ProUICascadebuttonPopupmenuSet() function. To add it directly to the menubar, use the ProUIMenubarNamesSet(). The input arguments for the function are:
dialog—Specifies the name of the dialog box.
name—Name of the menupane to be added.
Example 1: Source for Dialog with Text Question, OK and Cancel Buttons
The example in the file UgUIYesnoDialog.c located at <creo_toolkit_loadpoint>/protk_appls/pt_userguide/ptu_ui, shows the source code that uses this dialog.
Was this helpful?