User's Guide

Building the client window

The ShoppingServerView created in the previous section must be running before proceeding with this section. VisualAge makes it very easy to create a DDE client when the DDE server to which it will connect is already running. We will be exploiting these techniques in this section.

Open the VisualAge Organizer on ShoppingList and create a new visual part named ShoppingClientView.

Use a Text part and a single-selection List part to create the client window part as shown in the figure in Using DDE with Smalltalk objects.

Specifying the DDE client settings

Because this is the client window, add a DDE Client part. On page one of the General settings of the DDE Client part select the Update list push button to the right of the Server name list. VisualAge will determine what DDE servers are running on the system and add their names to the combo box. Select ShoppingListServer from the combo box.

Select the Update list push button to the right of the Topic list. VisualAge will determine what topics the selected server supports and add their names to the combo box. Select shopping from the combo box.

Next, select Add supported items to display the supported items and their formats.

Your settings page will appear as follows:
DDE Client settings

VisualAge automatically added all the items, supported by the selected server and topic, to the table. All the formats default to string. The formats and topicitemlist items are automatically added by VisualAge for every DDE server part. These items are used by VisualAge to determine the other items that the DDE server supports. In other words, VisualAge used DDE to determine that the selected server supports the grocerylist and groceryitem items.

Select the grocerylist row. Select smalltalk object from the Data format combo box. Select Apply to change the format for grocerylist to a smalltalk object.

Delete the formats row and the topicitemlist row by selecting the row number and then selecting Delete item. The DDE Client part is not interested in these items.

Select OK to accept the changes to the settings page.

Making the connections

The objective, visually, is to update the Text part and the List part to reflect the data received from the DDE server. To accomplish this, make the connections to the DDE Client part as follows:

  1. Connect the Window part's aboutToOpenWidget event to the DDE Client part's connect action. This establishes the DDE connection to the server. VisualAge will make only one attempt to connect to a DDE server when the window is about to open. Therefore, the server must already be running when the client is started.
  2. Connect the Text part's object attribute to the DDE Client part's groceryitem_string attribute. This will forward the data received from the DDE server to the Text part.
  3. Connect the List part's items attribute to the DDE Client part's grocerylist_smalltalk object attribute. This will set the items in the List part to the Smalltalk object received from the DDE server.

Save your work and then test your DDE application.

Try adding a few items to the DDE server's list by typing in the Text part and selecting Add. As you type, the string should show up in the DDE client's Text part, keystroke by keystroke. When you select Add each item should be added to the lists of both the DDE server and DDE client. Select an item in the DDE server's list and then select Remove. The selected item should be removed from both lists.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]