Change the Opening Position of the Dialog using VU.FbOpenDialog

kblundy
2024-05-05
2024-05-09
  • 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:

    PROGRAM OPEN_DIALOG
    VAR
        xOpenLatchSettingDialog : BOOL;
        TopLeftDialog : VisuStructPoint ;
        fbOpenLatchSettingsDialog   :   VU.FbOpenDialog ;
    END_VAR
    
    
    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');
    ELSE
            xOpenLatchSettingDialog:= TRUE ;
                IF fbOpenLatchSettingsDialog.xError THEN
                    xOpenLatchSettingDialog := FALSE;           
                END_IF
    END_IF
    

    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;
    END_IF
    IF fbOpenLatchSettingsDialog.xDone OR fbOpenLatchSettingsDialog.xError THEN
        fbOpenLatchSettingsDialog.xExecute := FALSE;
    END_IF
    
    TopLeftDialog.iX := 100;
    TopLeftDialog.iY := 23;
    fbOpenLatchSettingsDialog(
        itfClientFilter:= VU.Globals.OnlyTargetVisu, 
        sDialogName:= 'visu_AlarmLatchSettings', 
        xModal:= TRUE, 
        pTopLeftPosition:= ADR(TopLeftDialog)
    );
    
     

Log in to post a comment.