The following tasks are associated with using an
IVBFileDialog* part in visual composition. Tasks that are common
to many parts are described in related topics.
-
- Defining the title
- To define a title for the dialog, set the title
property in the IVBFileDialog* property sheet. Enter the
title in the value column.
- Setting the initial file name
- To specify an initial file name for the dialog, set the initialFileName
property in the IVBFileDialog* property sheet. Enter the
fully-qualified file name in the value column.
- Filtering the list
- To list only files of a particular type, set the initialFileType
property in the IVBFileDialog* property sheet. Enter the
file type in the value column. Leave this property empty
to list all files.
- Defining the OK button text
- To specify text, such as Open or Save as,
for the OK push button, set the okButtonText
property in the IVBFileDialog* property sheet. Enter the
text in the value column.
- Assigning ownership
- An IVBFileDialog* part serves the frame window that owns
it. If you have only one frame window in a composite
part, the IVBFileDialog* part is automatically owned by
that frame window. To provide a file dialog for an
additional frame window, do the following:
- Add an IVBFileDialog* part for the additional
window.
- Set the owner property in the part
property sheet. Enter i, followed by the
frame window partName value, followed by ().
For example, if you want a frame window named FrameWindow1()
to own the file dialog, enter iFrameWindow1.
- Opening the dialog
- To show the dialog when the user selects a menu choice,
connect the IMenuItem* commandEvent feature to the
IVBFileDialog* showModally action.
- Calling an action for a file operation
- To call a file action, connect to the action and provide
the file name. For example, to load an IMultiLineEdit*
part from a file, connect the IVBFileDialog* fileName
attribute to the IMultiLineEdit* importFromFile
action. The file dialog provides the file name when the
user clicks the OK button.
- Calling a member function for a file operation
- To call a member function for the file operation, do the
following:
- Connect the IVBFileDialog* pressedOkEvent
feature to the free-form surface.
- Select the All Features choice on the
connection menu.
- Enter the signature of a member function to
perform the operation.
- Connect the IVBFileDialog* fileName
attribute to a file name parameter on the
connection to the member function.
- Running custom logic for a file operation
- To run custom logic for the file operation, do the
following:
- Connect the IVBFileDialog* pressedOkEvent
feature to the free-form surface.
- Select Custom logic on the connection
menu.
- Enter C++ code to perform the operation. To
access the file name in your custom logic, select
Source. Enter the get member function of
the fileName attribute after the source
pointer inserted into your code. This is the
resulting code segment:
source->fileName()
Working with VisualAge User
Interface Parts
IVBFileDialog
Property Settings --
IVBFileDialog
Portability --
IVBFileDialog