Hello Alex,
if you have a couple of visualisations inside a Frame, they are numbered from 0 to n. With a related integer variable you can select one of the visualisations. The Name in the Frame properties is "Switch Frame".
Original text from CODESYS help:
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanx Rudolf! And I also figured out how to switch main visualizations,
Here's tiny example:
/// Switch visualizations via program.
/// Important: This program must be called in the VISU_TASK
PROGRAM SwitchVisu
VAR
pClient: POINTER TO VisuElems.VisuElemBase.VisuStructClientData; // Pointer to the client
xSomething: BOOL;
END_VAR
//program
IF xSomething THEN
VisuElems.VisuElemBase.g_VisuManager.SetMainVisu(pClient , 'Visualization_1');
END_IF
IF xSomething=FALSE THEN
VisuElems.VisuElemBase.g_VisuManager.SetMainVisu(pClient , 'Visualization');
END_IF
regards,
Alex
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I still would go with the frames and frame variables as Rudolf already suggested. That is most easiest way to do it. You can use your existing visualizations within frames and you don't have to modify them much.
Last edit: MaraP 2020-09-04
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
@maraP well, thats is what i am doing, i just wonder if the order of the visualization when you pick in the visualization frame selection, is the same. like first visu = 0, secound = 1 ect. Or maybe it is possible to give each visu it's own index
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello!
Anybody knows how to change a shown visualization or frame within a program? I tried:
IF xSomething THEN
VisuElems.CURRENTVISU := 'Motor';
END_IF
But doesn't works, seems that you can't assign value to VisuElems.CURRENTVISU variable.
Works only for output,like:
IF VisuElems.CURRENTVISU = 'Motor' THEN
xSomething:=TRUE;
END_IF
regards, alex
Hello Alex,
if you have a couple of visualisations inside a Frame, they are numbered from 0 to n. With a related integer variable you can select one of the visualisations. The Name in the Frame properties is "Switch Frame".
Original text from CODESYS help:
Thanx Rudolf! And I also figured out how to switch main visualizations,
Here's tiny example:
/// Switch visualizations via program.
/// Important: This program must be called in the VISU_TASK
PROGRAM SwitchVisu
VAR
pClient: POINTER TO VisuElems.VisuElemBase.VisuStructClientData; // Pointer to the client
xSomething: BOOL;
END_VAR
//program
IF xSomething THEN
VisuElems.VisuElemBase.g_VisuManager.SetMainVisu(pClient , 'Visualization_1');
END_IF
IF xSomething=FALSE THEN
VisuElems.VisuElemBase.g_VisuManager.SetMainVisu(pClient , 'Visualization');
END_IF
regards,
Alex
Hmm, there's a tiny issue with this solution: It doesn't work when you are online on PLC. Don't know why??? Anyway works perfect when in runtime .
regards,
Alex
where does the order of the visualization appear or is it just the order in the selection window.
I still would go with the frames and frame variables as Rudolf already suggested. That is most easiest way to do it. You can use your existing visualizations within frames and you don't have to modify them much.
Last edit: MaraP 2020-09-04
@maraP well, thats is what i am doing, i just wonder if the order of the visualization when you pick in the visualization frame selection, is the same. like first visu = 0, secound = 1 ect. Or maybe it is possible to give each visu it's own index