C0357: "GetNextClient" is obsolete, use VisuUtils instead

sedoerr
2021-05-03
2025-03-27
  • 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

     
  • pistola - 2025-03-27

    I'm having some troubles with this same issue and I'm wondering if someone can help me out.

    On a settings visual I allow the operator to enter some values however if they activate the page change button it will change the change with the Numpad dialog open. Since I'm using Visuelems.CURRENTVISU to change the pages I came across this code noted below for determining if the Numpad dialog was active.

    This code worked great however now in 3.5.19 it's now obsolete. I've tried following the directions in the attached program above however I can't see to get it to work in my program.

    Can anyone provide some help to determine if a dialog is open?

    FUNCTION Check_Dialog_Open : Bool
    VAR_INPUT
        sDialogName : STRING; // Input variable for the name of the dialog
    END_VAR
    VAR
        pstClientData : POINTER TO VisuElems.VisuStructClientData;  // Pointer to the client data structure
        itfDialogManager : VisuElems.IDialogManager;  // Interface for the dialog manager
        itfMyDialog : VisuElems.IVisualisationDialog; // Interface for the specific visualisation dialog
    END_VAR
    
    // Begin the iteration over the client manager
    VisuElems.g_ClientManager.BeginIteration();
    
    // Loop through each client until no more clients are found
    WHILE (pstClientData := VisuElems.VisuElemBase.g_ClientManager.GetNextClient()) <> 0 DO
        // Get the dialog manager interface
        itfDialogManager := VisuElems.g_VisuManager.GetDialogManager();
    
        // Get the specific dialog interface using the dialog name
        itfMyDialog := itfDialogManager.GetDialog(sDialogName);
    
        // Check if the dialog is open for the current client
        Check_Dialog_Open := VisuDialogs.VisuDlgUtil_IsDialogOpen(itfMyDialog, pstClientData, itfDialogManager);
    
        // If the dialog is open, exit the loop
        IF Check_Dialog_Open THEN
            EXIT;
        END_IF
    END_WHILE
    
     

    Last edit: pistola 2025-03-27

Log in to post a comment.