Data Sharing Between Apps
The Glue42 Channels are enabled by default when registering a VBA window as a Glue42 Window. You have to provide handler implementations for the Channel related events that will be raised due to interaction with the Glue42 Window instance - changing Channels and handling Channel data updates. When the Glue42 Channels are enabled, a Channel Selector box is available in the window title bar.
Note that currently the
SetChannelSupport method only hides or shows the Channel Selector, but doesn't enable or disable the Channel support. This can be done only during window registration.
// Toggle the visibility of the Channel Selector. if glueWin.GetChannelSupport() then glueWin.SetChannelSupport(False) else glueWin.SetChannelSupport(True);
Handling Channel Change
function TMainForm.HandleChannelChanged(const glueWindow: IGlueWindow; const channel: IGlueContext; prevChannel: GlueContext): HResult; begin if not Assigned(channel) then begin // Previous Channel deselected, no new Channel selected. ... end else begin // New Channel selected. ... end; Result := S_OK; end;
Subscribing for Channel Updates
function TMainForm.HandleChannelData(const glueWindow: IGlueWindow; const channelUpdate: IGlueContextUpdate): HResult; var channel: IGlueContext; data: TGlueContextValueArray; begin channel := channelUpdate.GetContext(); // Get the Channel data in a native data structure. rawData := channel.GetData(); data := SA_AsTranslatedContextValues(rawData); ... SafeArrayDestroy(rawData); Result := S_OK; end;
To publish data to a Channel, you must update the shared context object dedicated the respective Channel. For details on how to update a shared context object, see the
Shared Contexts > Updating a Context section.
Note that you must only update the value of the
"data" property of the context object. The
"meta" properties must not be modified, because they are specifically set for each Channel.