Advanced PowerBuilder

HomePrevious Lesson: The RemoteExec Event
Next Lesson: The RemoteRequest Event

The RemoteSend Event

This event occurs whenever the client sends data to PowerBuilder. In the Word macro, we used the DDEPoke command, so we have to add code here to handle it.
String lCommand, lApplication, lTopic, lItem, lData, lDWArg
int lRetVal
Long lRowNoFound
lRetVal = GetDataDDEOrigin( lApplication, lTopic, lItem )
If lRetVal = 1 Then
   GetDataDDE( lData )
   lDWArg = "product_no = " + lItem
   lRowNoFound = dw_1.Find( lDWArg, 0, dw_1.RowCount())
   If lRowNoFound > 0 Then
      dw_1.SetItem(lRowNoFound,"product_description",lData)
      RespondRemote( TRUE )
   Else
      RespondRemote( FALSE )
   End If
End If

Just to remind you, the DDEPoke command was:

 
DDEPoke channel, "3", "Testing data,(DDE from Word)"

The second parameter is the Item we are interested in and the third parameter is the data we want to send. The translation would be 'Find the item with product_no 3 and replace the product_description with "Testing data, (DDE from Word)''.

The GetDataDDE() function strips the value of the third parameter and places it in a local variable, to be ready when we successfully locate the Item. We then simply replace the current Title with the data in the local variable.
HomePrevious Lesson: The RemoteExec Event
Next Lesson: The RemoteRequest Event