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 via IEC code

Anonymous
2016-11-21
2016-11-30
  • Anonymous - 2016-11-21

    Originally created by: Massimo.Milluzzo

    Hi all,
    I'm trying to open a custom dialog in my project (Codesys 3.5.9.30) without success.

    I created a "Visualization" set as dialog with a couple of buttons and a rectangle with text.
    In my main page, when the user click a button, I have to perform some operations and then, if the operations are completed, I need to open this dialog.
    I tried with this code:

    VAR_GLOBAL
        dialogMan : VisuElems.IDialogManager; // Dialog manager
        openSaveDialogConfirm : VisuElems.IVisualisationDialog; // Reference to the custom dialog
        pClientData : POINTER TO VisuElems.VisuStructClientData;
        visuRect : POINTER TO VisuElems.VisuStructSimpleRectangle;
    END_VAR
    // In my PLC_PRG
    IF dwOperationResult = 0 THEN // The file already exist. Ask for overwrite
        GVL.openSaveDialogConfirm := GVL.dialogMan.GetDialog('Dialogs.ConfirmDialog'); // Get the reference to the FileOpenSave dialog
        (* Check if the dialog exist, if so try to open it *)
        IF GVL.openSaveDialogConfirm <> 0 THEN
            GVL.visuRect := ADR(GVL.pClientData^.rClientRect);            
            xResult := GVL.dialogMan.OpenDialog(GVL.openSaveDialogConfirm,ADR(GVL.pClientData),TRUE,GVL.visuRect);
        END_IF
    END_IF
    

    All references to the objects are set, the variable xResult becomes true but the dialog is not displayed.
    I have no clue because the documentation is missing, can you help me?

    Thank you,
    Massimo

     
  • AlexD

    AlexD - 2016-11-29

    Take a look here l viewtopic.php?f=25&t=7385 l
    You can open dialog for each "logged" users on certain application event

     
  • Anonymous - 2016-11-30

    Originally created by: Massimo.Milluzzo

    Yes, you copied the example from codesys store; I did the same thing.

    Actually my question becomes: why should I use OpenDialog4? What are the other three functions used for?

     
  • AlexD

    AlexD - 2016-11-30

    Here is simplified

    dialog1.rar [54.07 KiB]

     
  • Anonymous - 2016-11-30

    Originally created by: Massimo.Milluzzo

    Thank you

     

Log in to post a comment.