Different instances of CygNet Studio and CygNet Vision on the same computer can efficiently communicate with each other via the SendSharedMessage script method and EventSharedMessageReceived event.
The SendSharedMessage method on the TheView sends a message to another instance of CygNet Studio or CygNet Vision. The method contains three parameters:
| Parameter | Required | Description |
|---|---|---|
|
messageId |
Yes |
The ID used to categorize the message. |
|
data |
Yes |
The body of the message. |
|
true/false |
No |
An optional Boolean parameter to indicate whether or not the application sender instance should also receive the shared message (
|
See SendSharedMessage for more information.
The EventSharedMessageReceived event on TheFrame/TheView can receive a message sent from another instance of CygNet Studio or CygNet Vision by the SendSharedMessage method of TheView.
See EventSharedMessageReceived for more information.
Interprocess communication between nested views and their parent screens work in the following way:
false (to not to send the message to itself), the message will not be sent to any nested views contained within the sending parent screen.true, the message will be sent to any nested views contained within the sending parent screen.true, false, or not specified).The following code example will send a message to all CygNet Studio and CygNet Vision instances running on the same computer. The message has a messageId that can be used to categorize the message, a body (data) that contains the necessary information to be shared, and a Boolean handler (false) to indicate that all the CygNet Studio and CygNet Vision instances can receive the shared message except the sender instance.
In this example, we're sending the ID of "CHANGE_LEVEL1_FACILITY" which could be interpreted by the receiver instance to change the facility on a particular type of screen to whatever is sent in the body ("MYSITE.UIS::MY_WELL").
|
'(Declarations)
Sub SendIPCMessage(messageId, data) ' send a message to all other Studio/Vision instances running on this machine TheView.SendSharedMessage messageId, data, false End Sub
'End of (Declarations)
…
Sub SendSharedMessageButton_EventClick()
Dim This : Set This = SendSharedMessageButton SendIPCMessage("CHANGE_LEVEL1_FACILITY", "MYSITE.UIS::MY_WELL")
End Sub |
|
Sub TheView_EventSharedMessageReceived(MessageID, Data) ' receive message Dim This : Set This = TheView If MessageID = "CHANGE_LEVEL1_FACILITY" Then TheView.Facility = Data End If End Sub |