showInsertForm

showInsertForm(allow:   Integer,
               initDir: String;
               filter:  String): Integer;

The showInsertForm method of the OleControl class initiates a modal dialog, enabling the user to select the OLE object to be loaded into the control.

The code fragment in the following example shows the use of the showInsertForm method.

beginTransaction;
if oleReview1.showInsertForm(1, null, "All File |*.*|Notepad
             (*.txt)|*.txt") <> -1 then
    create obj;
    obj.copy(oleReview1.oleObject);
endif;
if oleReview2.showInsertForm(1, null, "All File |*.*|Notepad
             (*.txt)|*.txt") <> -1 then
    create obj;
    obj.copy(oleReview2.oleObject);
else
    create obj;
    obj.copy(oleReview3.oleObject);
endif;
commitTransaction;

The allow parameter values are listed in the following table.

Verb Description
0 embed & link option enabled (new)
1 embed option only allowed
2 Linked object only allowed

The initDir parameter specifies the initial directory for browse options. The initial directory defaults to the current directory if an empty string is passed.

The filter parameter specifies the file type filter available during browse options. The filter defaults to all files if an empty string is passed.

The showInsertForm method returns the values listed in the following table.

Value Description
-1 The user cancelled the dialog
1 An embedded object was selected
2 A link object was selected

If the user selected an OLE object, that OLE object is loaded into the oleObject property of the OleControl class.

When an OLE object is selected, the OLE server handling that object is initiated asynchronously. The showInsertForm method completes before the OLE object is loaded into the control.