Methods Introduced:
The method pfcSession::UIOpenFile opens the dialog box to browse directories and open files. The method lets you specify options for the file open dialog box
using the objects pfcFileOpenOptions and pfcFileUIOptions.
Use the method pfcFileOpenOptions::Create to create a new instance of the pfcFileOpenOptions object. You can specify a filter string to include only files of a particular type. The filter string is specified using
file extension. In the input argument FilterString you can specify all types of files extensions with wildcards separated by commas, for example, *.prt, *.asm, *.txt, *.avi, and so on. Use the methods pfcFileOpenOptions::GetFilterString and pfcFileOpenOptions::SetFilterString to get and set the types of file extensions.
Use the methods pfcFileOpenOptions::GetPreselectedItem and pfcFileOpenOptions::SetPreselectedItem to get and set the name of an item that must be preselected in the dialog box.
The pfcUI::FileUIOptions object contains the following options:
|
• |
DefaultPath—Specifies the name of the path to be opened by default in the dialog box. Use the method pfcFileUIOptions::SetDefaultPath to set this option. |
|
• |
DialogLabel—Specifies the title of the dialog box. Use the method pfcFileUIOptions::SetDialogLabel to set this option. |
|
• |
Shortcuts—Specifies an array of file shortcuts of the type pfcFileOpenShortcut. Create this object using the method pfcFileOpenShortcut::Create. This object contains the following attributes:
|
○
|
ShortcutName—Specifies the name of shortcut path to be made available in the dialog box. |
|
○
|
ShortcutPath—Specifies the string for the shortcut path. |
Use the method pfcFileUIOptions::SetShortcuts to set the array of file shortcuts.
|
The method wfcWSession::UIOpenFileType opens the dialog box to browse directories and open files. The method lets you specify options for the file open dialog box
using the objects wfcFiletypeOpenOptions and pfcFileUIOptions.
Use the method wfcFiletypeOpenOptions::Create to create a new instance of wfcFiletypeOpenOptions object. You can specify a filter string to include only files of a particular type in the dialog box. In the input argument
ModelFiletypes, you can specify an array of file types using the enumerated data type wfcMdlfileType. Use the methods wfcFiletypeOpenOptions::GetModelFiletypes and wfcFiletypeOpenOptions::SetModelFiletypes to read and set the file types. Use the methods wfcFiletypeOpenOptions::GetPreselectedItem and wfcFiletypeOpenOptions::GetPreselectedItem to get and set the name of an item that must be preselected in the dialog box.
Note
The methods pfcSession::UIOpenFile and wfcWSession::UIOpenFileType, do not actually open the file, but return the file path of the selected file.
The method pfcSession::UISaveFile opens the save dialog box. The method accepts options similar to pfcSession::UIOpenFile through the pfcFileSaveOptions and pfcFileUIOptions objects. Use the method pfcFileSaveOptions::Create to create a new instance of the pfcFileSaveOptions object. When using the Save dialog box, you can set the name to a non-existent file.
The method wfcWSession::UISaveFileType opens the save dialog box. The method accepts options similar to wfcWSession::UIOpenFileType. The method lets you specify options for the save dialog box using the objects wfcFiletypeSaveOptions and pfcFileUIOptions. Use the method wfcFiletypeSaveOptions::Create to create a new instance of the wfcFiletypeSaveOptions object. You can specify a filter string to include only files of a particular type. In the input argument ModelFiletypes, you can use the specify an array of file types using the enumerated data type wfcMdlfileType. Use the methods wfcFiletypeSaveOptions::GetModelFiletypes and wfcFiletypeSaveOptions::SetModelFiletypes to read and set the file types. Use the methods wfcFiletypeSaveOptions::GetPreselectedItem and wfcFiletypeSaveOptions::GetPreselectedItem to get and set the name of an item that must be preselected in the dialog box.
Note
|
• |
The methods pfcSession::UISaveFile and wfcWSession::UISaveFileType, do not actually save the file, but return the file path of the selected file. |
|
• |
For multi-CAD models, in a linked session of Creo Parametric with Windchill, the methods pfcSession::UISaveFile and wfcWSession::UISaveFileType do not support a file path location on local disk. |
The method pfcSession::UISelectDirectory prompts the user to select a directory using the Creo dialog box for browsing directories. The method accepts options through the pfcDirectorySelectionOptions object which is similar to the pfcFileUIOptions object (described for the method pfcSession::UIOpenFile). Specify the default directory path, the title of the dialog box, and a set of shortcuts to other directories to start browsing.
If the default path is specified as NULL, the current directory is used. Use the method pfcDirectorySelectionOptions::Create to create a new instance of the pfcDirectorySelectionOptions object. The method pfcSession::UISelectDirectory returns the selected directory path; the application must use other methods or techniques to perform other relevant tasks
with this selected path.
The method pfcBaseSession::UIRegisterFileOpen registers a new file type in the dialog box in Creo application. This method takes the pfcFileOpenRegisterOptions and pfcFileOpenRegisterListener objects as its input arguments. These objects are as follows:
|
• |
pfcFileOpenRegisterOptions—This object contains the options for registering an open operation. Use the method pfcFileOpenRegisterOptions::Create to create a new instance of the object. It contains the following options:
|
○
|
FileDescription—Specifies the short description of the file type to be opened. This description appears for the file type in the dialog box. Use the method pfcFileOpenRegisterOptions::SetFileDescription to modify this option. |
|
○
|
FileType—Specifies the file type to be opened. The file type appears as the file extension in the dialog box. Use the method pfcFileOpenRegisterOptions::SetFileType to modify this option. |
|
|
• |
pfcFileOpenRegisterListener—This object provides the action listener methods for the new file type to be registered. The method pfcFileOpenRegisterListener::FileOpenAccess is called to determine whether the new file type can be opened using the dialog box. The method pfcFileOpenRegisterListener::OnFileOpenRegister is called on clicking Open for the newly registered file type. |
The method pfcBaseSession::UIRegisterFileSave registers a new file type in the Save a Copy dialog box in Creo application. This method takes the FileSaveRegisterOptions and pfcFileSaveRegisterListener objects as its input arguments. These objects are described as follows:
|
• |
pfcFileSaveRegisterOptions—This object contains the options for registering a save operation. Use the method pfcFileSaveRegisterOptions::Create to create a new instance of the object. It contains the following options:
|
○
|
FileDescription—Specifies the short description of the file type to be saved. This description appears for the file type in the Save a Copy dialog box. Use the method pfcFileSaveRegisterOptions::SetFileDescription to modify this option. |
|
○
|
FileType—Specifies the file type to be saved. The file type appears as the file extension in the Save a Copy dialog box. Use the method pfcFileSaveRegisterOptions::SetFileType to modify this option. |
|
|
• |
pfcFileSaveRegisterListener—This object provides the action listener methods for the new file type to be registered. The method pfcFileSaveRegisterListener::FileSaveAccess is called to determine whether the new file type can be saved using the Save a Copy dialog box. The method pfcFileSaveRegisterListener::OnFileSaveRegister is called on clicking OK for the newly registered file type. |