Previous Page | Next Page

Using OLE in SAS/AF Software under Windows

Inserting an OLE Object in a FRAME Entry


Introduction to Inserting an OLE Object in a FRAME Entry

SAS provides three items on the object Selection List to facilitate OLE:

OLE - Insert Object

inserts an OLE object as a new object of the type associated with a registered server application, as an object created from an existing file, or as an OLE control.

OLE - Paste Special

pastes an OLE object to the FRAME entry from the Windows clipboard.

OLE - Read Object

creates an object that references an existing HSERVICE entry in a SAS catalog.

These three items correspond to the three OLE classes in SAS/AF software: INSERT, PASTE, and READOLE.

In addition to using the Selection List to insert objects, you can select and drag objects from other Windows applications and drop them onto an open FRAME entry (in BUILD mode, or during run time if the frame or work area object is registered as a drop site for the SAS_DND_OLEOBJ representation).


Inserting an OLE Object

To insert an OLE object in a FRAME entry:

  1. From the COMPONENTS window, select the V6 objects item to expand the object tree.

  2. Scroll through the list of objects in the Selection List and select and hold down the left mouse button on OLE - Insert Object.

  3. Drag OLE - Insert Object to a position for the object in the FRAME entry. Release the mouse button to place the object. The Insert Object dialog box appears.

  4. Select the type of object that you want to insert. The list of objects that are available to you depends on which OLE-capable applications are registered on your system. Selecting a type of object will insert an object of that type into the FRAME entry.

    Alternatively, you can create an object from a file by clicking on Create from File. The file you specify must have been created by one of the applications you have available to supply OLE objects. For example, if you have Microsoft Excel installed on your system, you can create an object from an Excel spreadsheet file. You also have the option of making it a linked object (instead of embedded). For more information about linked objects, see Using Linked OLE Objects.

    When you have selected the type of object or filename to insert, click OK. SAS inserts the object into the FRAME entry.

  5. With the BUILD window active, select View [arrow] Properties Window

    In the Properties windows, select the object and select Object Attributes.

    Enter a name for the object entry in the Entry field. Two-level HSERVICE names are allowed, defaulting to the current catalog. You can also change the Name of the object. The HSERVICE entry is not created until you Save or End the FRAME editing session.

    Click OK.


Pasting an OLE Object from the Clipboard

To paste an OLE object from the Windows clipboard:

  1. From another Windows application, copy or cut to the Windows clipboard the object or data you want to include in your FRAME entry.

  2. From the COMPONENTS window, select the V6 objects item to expand the object tree.

  3. Scroll through the list of objects in the Selection List and select and hold down with the left mouse key OLE - Paste Special. Drag OLE - Paste Special to the frame. The Paste Special dialog box appears.

  4. Select the type of OLE object you would like to insert based on the clipboard contents. The object is determined by the application from which you copied the data. (For example, you would typically paste Microsoft Word data as a Microsoft Word object.)

  5. If you want the OLE object to link to the data instead of embed the actual data in the FRAME entry, choose Paste Link on the Paste Special dialog box. For more information about linked objects, see Using Linked OLE Objects.

    Note:   If you paste data from a temporary source (such as a document that you did not save), SAS will be unable to locate the data source when it attempts to link to it later when it no longer exists. You should save your data file before copying it to the Windows clipboard.  [cautionend]

  6. After you select the type of object to paste, click OK. SAS pastes the object into the FRAME entry.

  7. Select View [arrow] Properties Window . Select the object from the Properties box and click on Object Attributes.

  8. Enter a name for the object entry in the Entry field. Two-level HSERVICE names are allowed, defaulting to the current catalog. You can also change the Name of the object. The HSERVICE entry is not created until you Save or End the FRAME editing session.

    Click OK.


Reading an OLE Object from an HSERVICE Entry

To read an existing OLE object stored as an HSERVICE entry in a SAS catalog:

  1. From the COMPONENTS window, select the V6 objects item to expand the object tree.

  2. Scroll through the list of objects in the selection list and select and drag OLE - Read Object to the BUILD window.

  3. With the cursor over the blank object, right mouse click and select Object Attributes.

  4. In the OLE-Read Object Attributes window, enter the name of the HSERVICE entry in the Entry field. Two-level HSERVICE names are allowed, defaulting to the current catalog. To use the Select window to find the entry, click on the arrow next to the Entry field.

    Click OK. SAS inserts the object in the FRAME entry, displaying a representation of the object at the position you selected.

    Note:   You cannot change the name of an HSERVICE entry that you read in. If you want to assign a different name to the HSERVICE entry, copy the HSERVICE entry to a new name before you read the object.  [cautionend]


Inserting an OLE Object by Dragging It

To insert an OLE object into a FRAME entry by dragging and dropping it:

  1. Create the object using the server application. For example, if you want to embed a Microsoft Excel chart object into your FRAME entry, use Microsoft Excel to create the object. Or, you can select an OLE object that is embedded in another application.

  2. With both SAS and the server application running, arrange the application windows so that both the server application (with the object) and the SAS BUILD: DISPLAY window (with the FRAME entry) are visible on the screen.

  3. Select the object in the server application. Press the mouse button and drag the object from the server application to the position in the FRAME entry where you want to place the object. The cursor changes to a box with an arrow, indicating that the FRAME entry is a valid place to drop the object. You do not need to draw a region in the FRAME to insert the object. You can also use drag modifier keys, as discussed in Changing the Drag Action to control the drag and drop behavior.

    When you release the mouse button ("dropping" the object), SAS inserts the object into the FRAME, automatically creating a name and an HSERVICE entry for the OLE object. SAS displays a representation of the object at the position you selected.


Dragging OLE Objects During Run Time

You can allow the dragging and dropping of OLE objects while your SAS/AF application is running. To enable this action, you must register the OLE object type with a valid drag and drop representation.

OLE objects must be registered with the SAS_DND_OLEOBJ representation. For more information about registering objects for drag and drop, see the SAS/AF online documentation for information about working with the FRAME application development environment and for information about the Widget class.


Changing the Drag Action

By default, dragging an OLE object from another application into SAS moves the object (unless the object is of a type that can only be read and not removed). You can override this default action by using a drag modifier; a key press that indicates you want to perform a different drop action:

Alternatively, you can initiate a nondefault drag and drop action (if the server application supports it). Use the right mouse button to select the object and drag and drop it into the FRAME entry. When you release the mouse button, SAS displays a pop-up menu allowing you to select whether to move, copy, or link to the object. The choices in the pop-up menu might vary among different types of OLE objects.

Previous Page | Next Page | Top of Page