The following tasks are associated with using an
IVBFontDialog* 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 IVBFontDialog* property sheet. Enter the
title in the value column.
- Filtering the list
- To list only fonts in one font family, such as Helvetica
or Courier, set the Initial font family property
in the IVBFileDialog* property sheet. Enter the family
name in the value column. Leave this field empty to list
all available fonts.
- Defining preview text
- To provide preview text to show font appearance in the
dialog, set the Preview text property in the
IVBFontDialog* property sheet. Enter the text in the
value column.
- Assigning ownership
- An IVBFontDialog* part serves the frame window that owns
it. If you have only one frame window in a composite
part, the IVBFontDialog* part is automatically owned by
that frame window. To provide a font dialog for an
additional frame window, do the following:
- Add an IVBFontDialog* 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 font dialog, enter iFrameWindow1.
- Opening the dialog to set a font
- To set a font for a window or control, do the following:
- Connect an event to the IVBFontDialog* setFontFromWindowModally
action.
- Connect the this attribute of the target
part to the target parameter of the
event-to-setFontFromWindowModally
connection.
When the font dialog is opened, it shows the current
font for the part. When the user clicks the OK button,
the dialog applies the selected font to the part and
closes.
- Opening the dialog to return a font
- To get a font selection from a modal dialog, do the
following:
- Connect an event to the IVBFontDialog* showModally
action.
- Connect the IVBFontDialog* font attribute
to a target IFont* attribute.
When the user clicks the OK button, the selected font
is returned to the target attribute and the dialog
closes.
- Calling a member function for a font operation
- To call a member function for the font operation, do the
following:
- Connect the IVBFontDialog* pressedOkEvent
feature to the free-form surface.
- Select All Features on the
connection menu.
- Enter the signature of a member function to
perform the operation.
- Connect the IVBFontDialog* font attribute
to a font parameter on the connection to the
member function.
- Running custom logic for a font operation
- To run custom logic for the font operation, do the
following:
- Connect the IVBFontDialog* pressedOkEvent
feature to the free-form surface.
- Select Custom logic on the
connection menu.
- Enter C++ code to perform the operation. To
access the font selection in your custom logic,
select Source. Enter the get member
function of the font attribute after the
source pointer inserted into your code. This is
the resulting code segment:
source->font()
Setting Part Font Properties
Working with VisualAge User
Interface Parts
IVBFontDialog
Property Settings --
IVBFontDialog
Portability --
IVBFontDialog