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

Dialog result

ert
2016-10-19
2022-08-26
  • ert - 2016-10-19

    Hlelo,
    I am calling an OK/Cancel dialog from a Visualization. Is there any way to know on the Visualization that a certain button was pressed on the Dialog?
    Something like:

    (OnDialogClosed method:)
    IF DialogResult = OK THEN
    // perform action A
    ELSE
    // perform action B
    END_IF

     
  • ert - 2017-02-03

    Does nobody know the answer?
    Is it not possible at all?

    I thought that was the reason why Dialogs existed: to get a Yes / No (or other) response from a user and make use of the result on a Visualization...

     
  • JAPIB

    JAPIB - 2017-02-07

    Hello
    You can find a free example in the CODESYS Store, called "Visalization Dialog Box"

     
  • Anonymous - 2017-02-07

    Originally created by: Massimo.Milluzzo

    VAR
    Β  Β dlgManager Β  Β : VisuElems.IDialogManager; (* Dialog manager *)
    Β  Β visuDialogConfirm : VisuElems.IVisualisationDialog; (* Reference to the custom dialog *)
    Β  Β visuDialogResultΒ  Β : VisuElems.Visu_DialogResult; (* Get the button clicked. Possible results are OK, Cancel, Retry etc. *)
    END_VAR
    dlgManager := VisuElems.g_VisuManager.GetDialogManager();
    visuDialogConfirm := dlgManager.GetDialog("NameOfDialog"); // Get the reference to the custom confirm dialog
    visuDialogResult := visuDialogConfirm.GetResult();
    
     
  • confre - 2022-08-26

    Hello,
    I resume this old post to do a question about the dialogs.
    Is it possible to understand if a dialog is open or not?
    I want to associate a boolean variable TRUE if the dialog is open, FALSE if closed.
    Thank you

     
  • sedoerr - 2022-08-26
    FUNCTION CheckDialogOpen : BOOL
    VAR_INPUT
        sDialogName         : STRING;
    END_VAR
    VAR
        pstClientData       : POINTER TO VisuElems.VisuStructClientData;
        itfDialogManager    : VisuElems.IDialogManager;
        itfMyDialog         : VisuElems.IVisualisationDialog;   
    END_VAR
    
    VisuElems.g_ClientManager.BeginIteration();
    
    WHILE (pstClientData := VisuElems.VisuElemBase.g_ClientManager.GetNextClient()) <> 0 DO
        IF LEN(TO_STRING(pstClientData^.GlobalData.CurrentUserName)) <> 0 THEN  //remove if not using user manager
            itfDialogManager := VisuElems.g_VisuManager.GetDialogManager();
            itfMyDialog := itfDialogManager.GetDialog(sDialogName);
    
            CheckDialogOpen := VisuDialogs.VisuDlgUtil_IsDialogOpen(itfMyDialog,pstClientData,itfDialogManager);
        END_IF
    END_WHILE
    
     

Log in to post a comment.