|
This article is the second in a series on OpenDoc for OS/2OpenDoc 102by Rollin WhiteLast 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. DocumentsIn 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 ComponentIt'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 documentEmbedded 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 FeaturesThe 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 ContinuesComing 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/2OpenDoc 101, A Technology Frontier OpenDoc 202, Writing a Part using PartMeister
| ||||||||||||||||
|
|