OS/2 Products:
Clearlook
DBExpert
Junk Spy
Mesa 2
Relish
Rover Pack
Service Solutions
Product Forums
Technical Issues
OS/2 Articles

#### This article is the second in a series on OpenDoc for OS/2

# OpenDoc 102

#### by Rollin White

Last month, we discussed the architecture of OpenDoc at a relatively high level. This month we're going to look in practical terms at what it means to embed things into documents. To quickly review, embedding means to literally place one component within another.

The user interface notions in OpenDoc are generally consistent with OS/2. To open a document, just double click on the desktop object. To close it, double click on the system icon in the upper left hand corner of the window. The document has minimize and maximize buttons, menu bars, and sizeable frames. These are all things we're used to working with in OS/2.

### Components vs. Documents

In OpenDoc terminology, a document is the basic container into which other things can be put. Things within a document are called components, even though - on their own - they also may be documents. And, components can contain other components.

### Embedding Your First Component

It's very easy to embed components within documents. Simply open the OpenDoc templates folder and drag one of the templates into an open document. A new component, based on the template you dragged, is created within the document you dropped it into. T here is another technique, just as easy, to create new embedded components. After placing text on the clipboard, select the Edit->Paste menu option to create a new Text Part-based component within your original document.

###### Here, the "Press Me" button component is embedded in a Page Layout document.

Remember that these embedded components have all of the same properties as when they were not embedded. For example, if you right click onto the background of your document, you will get a pop-up menu. This is also true if you right click on any of the embedded parts. From that pop-up menu, you could select the Open As or the properties menu, whether it's an embedded component or the document.

###### Properties of the Page Layout container document

Embedded components also have new characteristics that are only available while they are embedded. Most important of these characteristics is the notion of the border which visually separates the embedded component from the document (or component) containing it.

There are two modes that a border can be in. Most of the time, the border indicates activation. The active border surrounds the active component much like windows in OS/2. The active component receives the keyboard input, and the OpenDoc menu options apply to it. It is important to note that only one component is ever active at a time. You can think of activation much like selecting a folder on your OS/2 desktop and bringing it to the foreground.

The second mode for a border is selection. You can select a border by clicking on the edge of an active component. You can also hold down the shift key and click on the background of the component. In traditional OS/2 terms, this is approximately like highlighting the entire contents of a document. When a component is selected, several operations apply to the entire component. You can copy it to the clipboard, or you can use the selection border to resize or move the component.

###### Now we have two embedded components in the Page Layout - the selected component (text in this example) has a selection border.

### Other OpenDoc Features

The importance of the notions of border selection and activation become apparent when you realize the extent to which components can be embedded. The idea of embedding is not limited to embedding just one component within a document. Rather, you can have many components within a document and many components within other components.

There a few other neat features built into OpenDoc. For example, each document, or collection of documents has the ability to record and store specific drafts. These drafts are carried around with the document, so that they can be reviewed at any time.

###### The Draft history window gives you access to all document drafts.

OpenDoc also supports the notion of linking. A link to a document causes the link to be updated whenever the original has been updated. A link is different than embedding a component because only a reference to the linked document exists within the container document. A link is different than a copy because the information will always be up to date.

### And the Series Continues

Coming next time, we'll examine OpenDoc parts at a nuts and bolts level to understand what it takes to build one. Then, down the road, we'll even build a part or two, so stay tuned.

### Also in this series on OpenDoc for OS/2

OpenDoc 101, A Technology Frontier

OpenDoc 201

OpenDoc 202, Writing a Part using PartMeister

Copyright 1996 the Southern California OS/2 User Group. Reproduced with permission from the July 1996 edition of the group's newsletter, OS/2 For You.
All trademarks remain the property of their respective owners.

Sundial Systems Corporation 909 Electric Avenue, Suite 204 Seal Beach, CA 90740 USA

www.SundialSystems.com Copyright © 1996 - 2000 Sundial Systems Corporation. ALL RIGHTS RESERVED. Relish is a registered trademark of Sundial Systems Corporation. Bun, Junk Spy, Type-to-Search, Triple Scoop, Personal Information Object, SmartCapitalization, SmartFormula, SmartFreeze, SmartMatrix, SmartRange, Sundial, Sundial Systems, and Sundial Systems Corporation are trademarks or tradenames of Sundial Systems Corporation. Clearlook is a trademark of Clearlook Corporation and used by Sundial Systems Corporation under license. DBExpert is a trademark of Designer Software, Inc. and used by Sundial Systems under license. Mesa, Formula Inheritance, MScript, AutoGrow, and SmartFill are trademarks of Athena Design, Inc., and used by Sundial Systems Corporation under license. Rover Pack is a trademark of Orange Hill Software and is used by Sundial Systems Corporation under license. IBM, OS/2, DB2, Common User Access, CUA, CID, Presentation Manager, REXX, and Workplace Shell are trademarks or registered trademarks of International Business Machines Corporation. OpenDoc is a registered trademark of Apple Computer Company. All other trademarks remain the property of their respective owners.