OLEDemo  -  Demonstration of Object Linking and Embedding

by Alan Wrigley

OLEDemo accompanies the Wimp Topics article in this month's RISC User magazine. It demonstrates the techniques described in the article for implementing OLE (object linking and embedding) in your own programs. OLE enables data embedded in documents (e.g. text, pictures etc.) to be transferred to the appropriate editor (Edit, Paint, Draw etc.) and re-imported after editing, without having to drag or save the data. A single click on the relevant frame in the document loads the data into the correct editor (installing the editor in the process if necessary), and choosing the editor's Save option after editing automatically exports the edited data back into the original document.

The program can be run from the RISC User menu system, or by double-clicking on its icon in a Filer window. An icon is installed on the icon bar. Clicking Select on this icon opens the main window, which consists of two frames which are initially empty. Dragging a text file to the window or the icon bar icon will display the text in the upper frame. Dragging a sprite file will display the first sprite in the file in the lower frame. Dragging either of these filetypes to the icon bar icon when the window is not open will open it first.

Clicking Select over either frame will start the OLE process on the data in that frame (if the frame is empty an error will be given). The text or sprite in the frame which is clicked will be loaded into the editor which is configured in your system to handle that type of file (e.g. Edit for text and Paint for sprites). When the editing is finished, simply choose the editor's Save option (without altering the filename) and the display in the OLEDemo window will automatically be updated.

The techniques employed are described in the aforementioned Wimp Topics article. The process makes use of a scrap file, and so deleting this file before the OLE process is complete, or saving the data from the editor under a different filename, will upset the process.

Copyright  Rheingold Enterprises 1995

