Chapter Contents

Previous

Next
SAS Companion for the Microsoft Windows Environment

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 OLE - Insert Object.

  3. Select a position for the object in the FRAME entry. As you move the mouse, the mouse pointer moves the outline of the object you want to insert. Click on the mouse button to place the object. The Insert Object dialog box appears.

  4. Select the type of object you want to insert. The list of objects 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 on [OK]. SAS then displays the OLE - Insert Object Attributes dialog box.

  5. Enter a name for the object entry in the Entry field. Optionally, you can also change the Name of the object. Two-level HSERVICE names are allowed, defaulting to the current catalog.

    Note:   The HSERVICE entry is not created until you Save or End the FRAME editing session.  [cautionend]

    Click on [OK]. SAS inserts the object in the FRAME entry, displaying a representation of the object at the position you selected. If you are creating the object as new (that is, you are not creating it from an existing file), then the object automatically enters an editing session with the server. If the object server supports visual editing, then this editing session uses visual editing. For more information about visual editing, see Editing an OLE Object within a FRAME Entry.


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 OLE - Paste Special. The Paste Special dialog box appears.

  4. Select the type of OLE object you would like to insert based on the clipboard contents. This 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 on [OK]. SAS then displays the OLE - Paste Special Attributes dialog box.

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

    Click on [OK]. SAS pastes the object in the FRAME entry, displaying a representation of the object at the position you selected.


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 OLE - Read Object. SAS displays the OLE - Read Object Attributes dialog box.

  3. 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 on [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 Using Drag and Drop

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. With the mouse button depressed, 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. Note that 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 Action of the Drag and Drop 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 and Dropping 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, 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 SAS/AF Software: FRAME Application Development Concepts and the Widget Class in SAS/AF Software: FRAME Class Dictionary.

Changing the Action of the Drag and Drop

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; that is, a key press that indicates that 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.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.