Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

C0357: "GetNextClient" is obsolete, use VisuUtils instead

sedoerr
2021-05-03
2021-05-04
  • sedoerr - 2021-05-03

    Hey there,

    since i changed to SP17, to get this new warning about POU "GetNextClient". I really use this often in my project.
    Does anyone know how to use VisuUtils instead?

     
  • Thomas - 2021-05-03

    Hey,
    hope the example of "VU.IVisualizationClientIteration" will help.

    Regards

     
  • sedoerr - 2021-05-03

    THX for this. I will check this if i have time.

    Edit: i think i need some food for thought.

    I have several functions which use "GetNextClient"

    for Example:

    FUNCTION CheckClientCount : INT
    VAR_INPUT
    END_VAR
    VAR
        pClient       :    POINTER TO VisuElems.VisuElemBase.VisuStructClientData;
    END_VAR
    
    VisuElems.g_ClientManager.BeginIteration();
    
    WHILE (pClient := VisuElems.VisuElemBase.g_ClientManager.GetNextClient()) <> 0 DO
        IF pClient^.GlobalData.ClientType = VisuElems.VisuElemBase.Visu_ClientType.WebVisualization THEN
          CheckClientCount:= CheckClientCount+1;
        END_IF
    END_WHILE
    
     

    Last edit: sedoerr 2021-05-03
    • m.prestel - 2021-05-04

      hey @sedoerr,
      have you checked out the example by Thomas?

      You can adjust the ClientFilter or use a predefined one from the VisuUtils.

      Best regards,
      Marcel

       
  • sedoerr - 2021-05-04

    @m.prestel
    yes, i checked the example, but at the moment, i don't understand how to replace "GetNextClient" with this what @Thomas has done in his example.

     
  • m.prestel - 2021-05-04

    @sedoerr

    In the example, the custom filter "ClientFilter" is used as itfClientFilter.
    The "ClientFilter" accepts currently all clients, since "IsAccepted" always returns true

    You can use the "ClientFilter" from the example, but VisuUtils also provides some predefined filters, see "Globals" inside VisuUtils.

    Once you defined your filter, check out "VisuClientIteration".
    In your case I would reset your counter inside "StartIteration" and increase it in HandleClient.

    Best regards,
    Marcel

     

Log in to post a comment.