home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1993 #2
/
Image.iso
/
database
/
p4w_all.zip
/
TI1438.ASC
< prev
next >
Wrap
Text File
|
1993-04-27
|
13KB
|
397 lines
PRODUCT : Paradox for Windows NUMBER : 1438
VERSION : 1.0
OS : WIN
DATE : April 27, 1993 PAGE : 1/6
TITLE : An Introduction to DDE and OLE
Intended Audience
This document is for users who have little or no experience in
DDE and OLE linking.
Prerequisites
You must have software that allows for linking on a Client and
Server basis.
Purpose of the TI
This document will prepare you to create simple links using the
Windows Clipboard, and will give you an understanding of linking
requirements, terminology and command structure. Also, it will
present an example to illustrate how Paradox for Windows is used
as a Client application (stores information from other
applications). Using Paradox for Windows as a Server application
will not be covered here. For answers to common questions about
DDE and OLE, refer to TI 1439.
Exchanging Data With DDE and OLE
Paradox for Windows has many ways of exchanging data with other
applications. Exchanging data means using a Windows function to
bring text, graphics, sound, or other information from one
application to another. After reading this document, you will
have a good understanding of the options available that allow
combining and assembling data from other applications into one
central location: your Paradox for Windows Table.
This document will address the following topics:
1. How do you bring part of a file (a picture from a paint or
a desktop publishing program, data from a database or
table, text from a document, cells from a spreadsheet, or
sound) from another Windows application into your Paradox
for Windows Table?
2. How do you modify objects in your Table that were created
by exchanging data from sources outside of Paradox for
Windows?
3. Will you see changes in these objects if you or someone
else modifies the original files?
PRODUCT : Paradox for Windows NUMBER : 1438
VERSION : 1.0
OS : WIN
DATE : April 27, 1993 PAGE : 2/6
TITLE : An Introduction to DDE and OLE
The functions discussed here will include the copying and pasting
of static objects, linked objects, and embedded objects. In this
document, the examples will use a word processing application as
an OLE (Object Linking and Embedding) and DDE (Dynamic Data
Exchange) server; the behavior of other OLE server applications
may be different.
Copying a picture from one application and pasting it into
another, results in a static image or a static object in the
target application.
A linked object has a pointer or reference to part of the
original source file and is capable of a dynamic exchange. This
means, if you or someone else modifies the part of the file that
your object in Paradox for Windows is linked to, the object will
reflect the change either directly or indirectly. This will be
illustrated in an example that follows.
An embedded object is an object that is copied from the original
file and pasted into an OLE object or OLE field in a Paradox for
Windows file. You become the owner of this pasted object and it
becomes a separate entity apart from the copied object in the
original file. If the original file is altered, the object in
the Paradox for Windows file remains unaffected. However, the
object in the Paradox for Windows document can only be altered by
the original application. This is discussed in a following
example.
The simplest way to illustrate how to bring text, pictures, or
sound into Paradox for Windows follows. For this example to work
as expected:
- A DDE and an OLE server, such as Microsoft Word for
Windows 2.0 or AMI PRO 2.0 or 3.0, etc., is used.
- The application program must be installed from diskettes
(so that the Windows registration database is updated),
and must be in the DOS PATH and the PC rebooted if
necessary.
1. If you are unsure of your application's DDE and OLE
capabilities, run the application, open a saved document,
select some text, and choose Edit | Copy. Then, leaving
PRODUCT : Paradox for Windows NUMBER : 1438
VERSION : 1.0
OS : WIN
DATE : April 27, 1993 PAGE : 3/6
TITLE : An Introduction to DDE and OLE
the document open, switch to the Program Manager, and
double-click on the Clipboard icon in the MAIN program
group. Select Display. You should see Link, OwnerLink,
Native, and Picture. Some of these will appear dimmed.
2. Create a Paradox for Windows table that has three fields;
an Alphanumeric (size 100) field, a Formatted Memo Field,
and an OLE field. No minimum size is required for the
Formatted Memo Field or the OLE field.
Two records will be used in this example; the first one for
static objects where you will paste into the Alphanumeric and
into the Formatted Memo fields, and the second record for a
dynamic link and an embed where you will paste link into the
Alphanumeric field and paste into the OLE field.
1. If your word processing application is not currently
running, run your application and open a saved document.
Select or reselect a few words of text (under 100
characters including spaces, no pictures, for this
example).
2. Choose Edit | Copy. This copies your selection together
with the application's DDE and OLE information to the
Windows Clipboard (a temporary storage area).
3. Leave your document open and return to Paradox for
Windows.
4. Open the new table and press [F9] to edit.
5. Choose Edit | Paste. This transfers a static image
(discussed in more detail below) of the text from the
Clipboard into the current field.
6. Tab once to the Formatted Memo Field.
7. Choose Table | Field View, then choose Edit | Paste. This
also transfers a static image of the text from the
Clipboard into the current field.
8. Choose Table | Field View, then Tab twice to move to the
Alphanumeric field in the next record.
PRODUCT : Paradox for Windows NUMBER : 1438
VERSION : 1.0
OS : WIN
DATE : April 27, 1993 PAGE : 4/6
TITLE : An Introduction to DDE and OLE
9. Choose Edit | Paste Link. This transfers the Link
information about your word processor application,
document, and the item from the Clipboard into the current
field.
10. Tab twice to the OLE field.
11. Choose Edit | Paste. This transfers a picture presented
from the word processor together with information about
embedding it from the Clipboard into the current field.
Now that the example table is set up, the next section of this
document will examine the different field objects and determine
how they might be used.
1. Move back to the first field in the previous record. The
Alphanumeric and the Formatted Memo fields in this record
now contain static text objects. You will see a copy of
the text from your word processor, but the font is
different. This field accepts text from the Clipboard
(minus the font attributes of the text). Also, it accepts
only as much text as will fit in the size field you
created (100 characters in this case).
The text appears in the same font as the default font for
Paradox for Windows. You can also change the font just
for that field (which affects all records in that field).
2. Tab to the Formatted memo field. You should now see the
text in the same font as it appeared when copied from your
word processor. If this field were a simple Memo field,
the text would appear the same as in the Alphanumeric
field. However, you cannot change the font in a Memo
field (hence the use of the Formatted Memo field). Again,
the text in these two fields of this record are static
objects. They are part of your table and no longer have
any connection to the original document or word processor.
The next section will discuss how Windows allows for dynamically
linking objects from different applications.
1. Move to the Alphanumeric field in the next record. The
contents of this field look totally different from what
PRODUCT : Paradox for Windows NUMBER : 1438
VERSION : 1.0
OS : WIN
DATE : April 27, 1993 PAGE : 5/6
TITLE : An Introduction to DDE and OLE
you might expect. What appears is a DDE string that looks
like: @DDE:WinWord!C:\WINWORD\LINK.DOC!DDE_LINK1!@. This
is the pointer to the text in the word processing
document. The item at the end of the string (DDE_LINK1)
is also stored in the original document, invisibly. It
points to the same block of text that was copied
originally.
2. Leave the table open and switch to your word processor.
Exit it and select "Yes" if it asks you to save changes.
The changes referred to are usually the link information
stored in the source document. Now, you should be back to
the field with the DDE link. Press [Shift+F2]. This
launches your word processor and what appears is the
entire document. You would see a change if you or someone
else changed the block of text that was originally copied.
This illustrates how data from files in other applications
are linked dynamically.
NOTE: Objects with Paradox for Windows can also dynamically link
to other objects within Paradox for Windows. A good
example of this is presented in the section "Using DDE in
queries" in Chapter 15 of the User's Guide.
The last Windows function to examine is OLE. When you paste into
an OLE field, you embed that part of the document you copied in
the word processor. This object ceases to have a connection to
the original document but can still be edited by the word
processor.
1. Exit the word processor and Tab twice to the OLE field.
The object rendered in the field will be either an icon of
the word processor or a graphic image of the text. The
appearance of this object is determined by the word
processor (or another application type). Usually OLE
capable word processors provide icons to the Clipboard as
a Picture when something is copied for the purpose of
being embedded. Paint and spreadsheet programs provide
graphic images of the actual data.
PRODUCT : Paradox for Windows NUMBER : 1438
VERSION : 1.0
OS : WIN
DATE : April 27, 1993 PAGE : 6/6
TITLE : An Introduction to DDE and OLE
2. Double-click on the field or press [Shift+F2]. Now you
see the word processor, but not the original document.
Only the text originally copied appears, and now you can
change it. If you Save, Exit, and double-click again, you
will see your changes.
Suggested Reading:
Microsoft Windows 3.1 Reading
Microsoft Windows 3.1 User's Guide Chapter 13
Microsoft Windows 3.1 Resource Kit Chapter 11
Microsoft Windows 3.1 Software Development Kit Volume 1,
Chapter 5 and 6
Paradox for Windows Reading
User's Guide
Chapter 15
ObjectPAL Developer's Guide
Chapter 5, "Passing arguments"
Chapter 9, "OLE: Object Linking and Embedding"
Chapter 11, "DDE: Link to other applications"
ObjectPAL Reference Manual
Chapter 3, "return"
Chapter 4, "AnyType", "view", "DDE", "OLE"
Chapter 5, "index"
TI 1439, "Answers to Common Questions About DDE and OLE"
DISCLAIMER: You have the right to use this technical information
subject to the terms of the No-Nonsense License Statement that
you received with the Borland product to which this information
pertains.