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

Change the Opening Position of the Dialog using VU.FbOpenDialog

  • kblundy - 2024-05-05

    I hope the community can help me with this. I need to use the Visu Utils FbOpenDialog to control the opening and closing of a dialog. I have the Opening and Closing working, but I can’t get the dialogue's position to be controlled.

    The code looks like this:

        xOpenLatchSettingDialog : BOOL;
        TopLeftDialog : VisuStructPoint ;
        fbOpenLatchSettingsDialog   :   VU.FbOpenDialog ;
    IF xOpenLatchSettingDialog THEN
            xOpenLatchSettingDialog:= FALSE ;
            TopLeftDialog.iX := 100;
            TopLeftDialog.iY := 23;
            fbOpenLatchSettingsDialog(sDialogName := 'visu_AlarmLatchSettings', xExecute := xOpenLatchSettingDialog , xModal := TRUE, itfClientFilter := VU.Globals.OnlyTargetVisu, pTopLeftPosition := ADR(TopLeftDialog));
            CloseVisuDialog(sDialogName:= 'visu_AlarmLatchSettings');
            xOpenLatchSettingDialog:= TRUE ;
                IF fbOpenLatchSettingsDialog.xError THEN
                    xOpenLatchSettingDialog := FALSE;           

    I can't seem to work out a way to make the values in TopLeftDialog.iX and TopleftDialog.iY be passed correctly in the call and for it to change the position of the dialogue box.
    The code is compiled, but the position has not been changed.

    Any guidance or suggestions for revising this code would be incredibly valuable. Your insights could be the key to solving this issue.


    Last edit: kblundy 2024-05-05
  • TimvH

    TimvH - 2024-05-09

    Probably best to call the FB continuously. So something like this could solve it:

    IF xOpenLatchSettingDialog THEN
        xOpenLatchSettingDialog := FALSE;
        fbOpenLatchSettingsDialog.xExecute := TRUE;
    IF fbOpenLatchSettingsDialog.xDone OR fbOpenLatchSettingsDialog.xError THEN
        fbOpenLatchSettingsDialog.xExecute := FALSE;
    TopLeftDialog.iX := 100;
    TopLeftDialog.iY := 23;
        itfClientFilter:= VU.Globals.OnlyTargetVisu, 
        sDialogName:= 'visu_AlarmLatchSettings', 
        xModal:= TRUE, 
        pTopLeftPosition:= ADR(TopLeftDialog)

Log in to post a comment.