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.
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:
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.
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:
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.