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

Detect if Dialog in Webvisu is opened?

sedoerr
2020-06-08
2020-06-09
  • sedoerr - 2020-06-08

    Hi there,

    is it possible to detect if a dialog is opened in the webvisu?

    Codesys 3.5.16.0

    BR
    Sebastian

     

    Last edit: sedoerr 2020-06-09
  • m.prestel - 2020-06-09

    Hello @sedoerr,
    what do you mean by DialogBox?
    Do you mean a dialog?

    Best regards,
    Marcel

     
  • sedoerr - 2020-06-09

    Hi there,

    yes exactly. In my program, i have several visualizations defined as dialogs to give users the option to make inputs. And i need to detect if one of these dialogs is opened.

     
  • m.prestel - 2020-06-09

    Hey,
    there are a few ways to detect if a dialog was opened.
    You can e.g. add an additional input action on the same input type and call some ST Code.

    Best regards,
    Marcel

     
    • sedoerr - 2020-06-09

      Hi Marcel,

      yes thats an option. But i have about 50 input actions which are calling a dialog. So it is a lot of work to use this way.

      I tried this way, but is am not sure if it is the right way:

      FUNCTION TEST : BOOL
      VAR_INPUT
          sDialogName         : STRING;
      END_VAR
      VAR
          pstClientData       : POINTER TO VisuElems.VisuStructClientData;
          itfDialogManager    : VisuElems.IDialogManager;
          itfMyDialog         : VisuElems.IVisualisationDialog;
          variable:DWORD;
      END_VAR
      
      VisuElems.VisuElemBase.g_ClientManager.BeginIteration();
      pstClientData := VisuElems.VisuElemBase.g_ClientManager.GetNextClient();
      
      WHILE pstClientData <> 0 DO
      itfDialogManager := VisuElems.g_VisuManager.GetDialogManager();
      itfMyDialog := itfDialogManager.GetDialog(sDialogName);
      pstClientData := VisuElems.VisuElemBase.g_ClientManager.GetNextClient();
      END_WHILE
      
       
  • sedoerr - 2020-06-09

    I found a solution for my problem:

    FUNCTION CheckDialogOpen : BOOL
    VAR_INPUT
        sDialogName         : STRING;
    END_VAR
    VAR
        pstClientData       : POINTER TO VisuElems.VisuStructClientData;
        itfDialogManager    : VisuElems.IDialogManager;
        itfMyDialog         : VisuElems.IVisualisationDialog;
    END_VAR
    
    //PrΓΌfen ob Dialogfenster geΓΆffnet
    VisuElems.VisuElemBase.g_ClientManager.BeginIteration();
    pstClientData := VisuElems.VisuElemBase.g_ClientManager.GetNextClient();
    
    WHILE pstClientData <> 0 DO
        itfDialogManager := VisuElems.g_VisuManager.GetDialogManager();
        itfMyDialog := itfDialogManager.GetDialog(sDialogName);
        CheckDialogOpen := VisuDialogs.VisuDlgUtil_IsDialogOpen(itfMyDialog,pstClientData,itfDialogManager);
        pstClientData := VisuElems.VisuElemBase.g_ClientManager.GetNextClient();
    END_WHILE
    
     
    πŸ‘
    1

Log in to post a comment.