Change shown visualizatoin from program

alex87
2013-05-16
2020-09-04
  • alex87 - 2013-05-16

    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

     
  • RudolfAtITD - 2013-05-21

    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:

     
  • alex87 - 2013-05-24

    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

     
  • alex87 - 2013-05-24

    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

     
  • michaeljohansen - 2020-09-03

    where does the order of the visualization appear or is it just the order in the selection window.

     
  • MaraP - 2020-09-04

    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
  • michaeljohansen - 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

     

Log in to post a comment.