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

Open dialog from ST previous to version 3.5.6

Lo5tNet
2017-01-05
2018-04-10
  • Lo5tNet - 2017-01-05

    I was wondering if anyone has an example of how to open a dialog box using ONLY ST previous to the example version in the store. The issue that I have run into is fulfilling the pClientData without passing it through a button press on a screen. Is the pClientData something I can get without using a visualization element? I can open a dialog if I call the function from a visualization element and pass in pClientData.

    I'm doing this with version 3.5.5.4

    Thanks for your time.

     
  • TimvH

    TimvH - 2017-01-24

    Yes this is possible.
    First you have to find out if any clients are available.
    If yes, then you can call a function to open a dialog.

    See below an example of a function you could call from your application whenever you want to open a dialog (pass the name of the visualization dialog as input):

    FUNCTION F_ShowDialog
    VAR_INPUT
       sDialogName : STRING;
    END_VAR
    VAR
       pstClientData : POINTER TO VisuElems.VisuStructClientData;
       itfDialogManager : VisuElems.IDialogManager;
       itfMyDialog : VisuElems.IVisualisationDialog;
       stVisuRect : VisuElems.VisuStructSimpleRectangle;
    END_VAR
    
    VisuElems.VisuElemBase.g_ClientManager.BeginIteration();
    pstClientData := VisuElems.VisuElemBase.g_ClientManager.GetNextClient();
    WHILE pstClientData <> 0 DO
       IF pstClientData^.GlobalData.ClientType = VisuElems.Visu_ClientType.TargetVisualization THEN
          itfDialogManager := VisuElems.g_VisuManager.GetDialogManager();
          itfMyDialog := itfDialogManager.GetDialog(sDialogName);
          stVisuRect.ptTopLeft.iX := ANY_TO_INT(INT#0);
          stVisuRect.ptTopLeft.iY := ANY_TO_INT(INT#0);
          stVisuRect.ptBottomRight.iX := ANY_TO_INT(10);
          stVisuRect.ptBottomRight.iY := ANY_TO_INT(10);
          itfDialogManager.OpenDialog(itfMyDialog, pstClientData, FALSE, ADR(stVisuRect));
       END_IF
       pstClientData := VisuElems.VisuElemBase.g_ClientManager.GetNextClient();
    END_WHILE
    
     
  • Lo5tNet - 2018-04-02

    Just wanted to say thank you TimvH.

     
  • Lo5tNet - 2018-04-05

    Do you know if there is a way to tell which client fired the event to open the dialog. The issue we are running into is the buttons on the display we are using are triggered from a function block and not on the visualization screens. This means that all the soft touch buttons only tie to the visualization through POU's and not using the hotkeys configuration.

    Can we tie these buttons to trigger a hotkey configuration? OR
    Can we tell which client sent the request to only have that targetvisu or webvisu respond to open the dialog?

     
  • Lo5tNet - 2018-04-10

    Do you know where I can find more information on the functions and methods being used? Putting a period at the end does not bring up anything and looking for it in the library doesn't help either.

     

Log in to post a comment.