Is there a way to independently (asynchronously) change the shown visualization between different WebVisu clients? Currently I am using VU.FbIterateClients to iterate through clients (follwing example from another thread) and also created a function block which implements VU.IVisualizationClientFilter, VU.IVisualizationClientIteration..Within this function block I am calling the fbChangeVisu: VU.FbChangeVisu; within the HandleClient method.
With this implementation however all web visualizations (clients), will change at once to the 'New_Visu' whenever the xChangeVisuCondition is TRUE.
(Currently I have un-checked, the checkbox Use CurrentVisu Variable under Visualization Manager/Settings, so I can have asynchronous display from different web-browsers accessing the controllers IP address)
A more detail code snippet of what I am trying to do below:
PROGRAMVisuHandling//<-- called from the VISU_TASKVARxExecute,xDone,xError,xBusy:BOOL;fbVisuIterate:VU.FbIterateClients;fbClientFilter:ClientFilter;fbinstItCallback:VisuClientIteration;END_VARfbVisuIterate(itfClientFilter:=fbClientFilter,itfIterationCallback:=fbinstItCallback,eError=>eError,xExecute:=xExecute,xBusy=>xBusy,xDone=>xDone,xError=>xError);
Then in the method of the
FUNCTION_BLOCK VisuClientIteration IMPLEMENTS VU.IVisualizationClientFilter, VU.IVisualizationClientIteration
Maybe the more adequate question is how do we properly use the VU.IVisualizationClientFilter to filter and make action only on the individual WebVisu client (not on all of the WebVisu's).
Any help, insights on the above is greatly appreciated!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm not sure you want to go in this direction, because the example below contains code which is marked as obsolete, but the library mentions that if no other option is possible, then it could be an escape... so be warned π¬
Add the following code to your "HandleClient" method
xQueryOK := __QUERYINTERFACE(itfClient, itfVisuClientRawData);IF xQueryOK AND xChangePage THEN VisuElems.g_VisuManager.SetMainVisu(pClientData := itfVisuClientRawData.ClientDataPointer, stVisu := 'visu2'); xChangePage := FALSE;END_IF
'visu2' in this case is just the name of a Visualization, of course you have to replace this with the name of the Visualization you want to switch to...
π
1
Last edit: TimvH 2023-06-23
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello!
Is there a way to independently (asynchronously) change the shown visualization between different WebVisu clients? Currently I am using VU.FbIterateClients to iterate through clients (follwing example from another thread) and also created a function block which implements VU.IVisualizationClientFilter, VU.IVisualizationClientIteration..Within this function block I am calling the fbChangeVisu: VU.FbChangeVisu; within the HandleClient method.
With this implementation however all web visualizations (clients), will change at once to the 'New_Visu' whenever the xChangeVisuCondition is TRUE.
(Currently I have un-checked, the checkbox Use CurrentVisu Variable under Visualization Manager/Settings, so I can have asynchronous display from different web-browsers accessing the controllers IP address)
A more detail code snippet of what I am trying to do below:
Then in the method of the
FUNCTION_BLOCK VisuClientIteration IMPLEMENTS VU.IVisualizationClientFilter, VU.IVisualizationClientIteration
Maybe the more adequate question is how do we properly use the VU.IVisualizationClientFilter to filter and make action only on the individual WebVisu client (not on all of the WebVisu's).
Any help, insights on the above is greatly appreciated!
I'm not sure you want to go in this direction, because the example below contains code which is marked as obsolete, but the library mentions that if no other option is possible, then it could be an escape... so be warned π¬
Add the following code to your "HandleClient" method
'visu2' in this case is just the name of a Visualization, of course you have to replace this with the name of the Visualization you want to switch to...
Last edit: TimvH 2023-06-23
Sorry new to CODESYS forge here.... I posted a new thread below instead of responding to you directly π Thank you so much for sharing!
Hello TimvH,
Thank you so much! that worked flawlessly.
Except, I see what you mentioned... It does contain code that is obsolete and I get the warning message:
C0357: POU 'SetMainVisu' has been marked as obsolete: Please use the methods of VisuUtils instead.
I am not sure what/which is the method that they are referring to, to use inside of the VisuUtils library to accomplish the same action.
If it is in fact the fbChangeVisu inside of VisuUtils, I still wonder if there is a way to filter the specific WebVisu client individually....
But what you shared above helped me out tremendously! Thank you!