CygNet Studio > Using TheFrame/TheView > Interprocess Communication

Interprocess Communication

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.

SendSharedMessage Method

The SendSharedMessage method on the TheView sends a message to another instance of CygNet Studio or CygNet Vision. The method contains three parameters:

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 (true or false).

  • If set to true then all the Studio/Vision instances will receive the shared message including the sender instance.
  • If set to false then all the Studio/Vision instances will receive the shared message except the sender instance.

See SendSharedMessage for more information.

EventSharedMessageReceived Event

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.

Nested Views

Interprocess communication between nested views and their parent screens work in the following way:

Script Example

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").

Sender Screen

'(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

Receiver Screen

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

Back to top

Let us know how we can improve this topic.

CygNet at weatherford.com

© 2020 Weatherford. All rights reserved.