get visu clients information

tvm
2022-06-28
2022-06-29
  • tvm - 2022-06-28

    I'm trying to get the size of each visualization client and store it in an array. There appears to be two approaches to getting information from the visu clients:

    Use the Visu Utils client iteration. Something like this thread: https://forge-codesys-com.translate.goog/forge/talk/Deutsch/thread/f14041c158/?xtrsl=auto&xtrtl=en&xtrhl=en-US&xtrpto=wapp#8477
    The problem, this works with an interface itfClinet of type VU.IVisualizationClient. This interface appears to include the information I need. When I go online and set a breakpoint, I can see variables like this, for example:

    itfClient._pClient^.rClientRect.pTopLeft
    

    However, I can't access this variable in my code. I'm not exactly sure why not, but pClient can't be accessed.

    I could use something like the example here: https://forge.codesys.com/prj/codesys-example/responsive-desi/home/Home/. This will give me the client size variables I want, for example:

    pClientData^.rClientRect.ptTopLeft
    

    However, pClientData^.GlobalData.GlobalClientID always reads -1.

    I think I would prefer to use the responsive design method. But is it possible to get the current client ID in the ClientSizeChanged method of a function block that implements VisuElems.IClientManagerListener3?

     

    Last edit: tvm 2022-06-28
  • tvm - 2022-06-29

    The part I really don't understand is this:

    If I set a breakpoint in the HandleClient method of the VU.IVisualizationClientIteration interface, I get the attached screenshot, which seems to show that pClient is part of itfClient (VU.IVisualizationClient).

    However, I can't access that pClient data in the program. I tried to use QUERYPOINTER(itfClient, pClientData), but it returns an invalid pointer

     
  • tvm - 2022-06-29

    For anyone else trying to figure this out, here's what finally worked:

    VAR_INPUT
        itfClient:          VU.IVisualizationClient;
    END_VAR
    VAR
        pClientWrapper:     POINTER TO VU.FbClientWrapper;
        pClientData:        POINTER TO VisuElems.VisuStructClientData;
    END_VAR
    __QUERYPOINTER(itfClient, pClientWrapper);
    pClientData:= pClientWrapper^.ClientDataPointer;
    

    then pClientData points to the correct place, for example pClientData^.rClientRect.ptBottomRight.iX

    This was all by trial and error, so I really don't know if this is the right way to do it. I wish Codesys would create better documentation.

     
  • tvm - 2022-06-29

    There is still one thing I don't understand, however. If I use the responsive design, with a Client Manager Listener implementing VisuElems.IClientManagerListener3, why does the GlobalClientID variable always return -1?

     

Log in to post a comment.