VCOM:Working with File/Folder Choose Dialogs

From Vectorworks Developer
Revision as of 15:09, 12 August 2013 by Root (talk | contribs) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

.SDK|SDK ..SDK:Types|SDK Types ..VCOM:VCOM (Vectorworks Component Object Model)|VCOM Basics ..VCOM:Class Reference|VCOM Class Reference

File Choose Dialog

The interface VCOM:VectorWorks:Filing:IFileChooserDialog allows you to specify filter for the shown files. The filter is composed of file extensions list.

On Win this list is shows as different filter entries.

On Mac there is no such thing and the filter's file extensions are combined into one list that is used to enable the files witch those extensions. If in the list 'Show All' is present then all the files are shown on Mac regardless the other extensions in the filter list.

File choose dialog for windows File choose dialog for Mac

IFileChooserDialogPtr	pFileChooser( IID_FileChooserDialog );
if ( pFileChooser == NULL ) 
   return;

pFileChooser->SetTitle( "file open title" );
pFileChooser->SetDefaultFileName( "fileName" );
pFileChooser->AddFilter( "ext1", "this is the first one" );
pFileChooser->AddFilter( "ext2", "this is the second one" );
pFileChooser->AddFilter( "ext3", "this is the third one" );
pFileChooser->AddFilterAllFiles();
if ( VCOM_SUCCEEDED( pFileChooser->RunOpenDialog() ) ) {
   IFileIdentifierPtr	pFileID;

   if ( VCOM_SUCCEEDED( pFileChooser->GetSelectedFileName( 0, & pFileID ) ) ) {
       // ...
   }
}

Folder Choose Dialog

This interface VCOM:VectorWorks:Filing:IFolderChooserDialog allows you to ask the user to choose a folder. The OS choose folder dialog is shown to do that.

Folder chooser for windows Folder chooser for Mac

VCOMPtr< IFolderChooserDialog >	pFolderDlg( IID_FolderChooserDialog );

vcomErr	= pFolderDlg->SetTitle( "This is title" );
vcomErr	= pFolderDlg->SetDescription( "this is desc" );

if ( VCOM_SUCCEEDED( pFolderDlg->RunDialog() ) ) {
    VCOMPtr<IFolderIdentifier>	pFolderID;
    vcomErr	= pFolderDlg->GetSelectedPath( & pFolderID );

    // ...
}

See Also

VCOM:VectorWorks:Filing:IFileChooserDialog | VCOM:VectorWorks:Filing:IFolderChooserDialog