L-force | plc designer – Lenze PLC Designer PLC Designer (R3-1) User Manual

Page 217

Advertising
background image

L-force | PLC Designer

Visualization

DMS 4.1 EN 03/2011 TD29

215

The respective functions OpenLoginDialog and OnLoginDialogClosed are available as
POUs in the project. See in the following a possible implementation:
Implementation of functions OpenLoginDialog and OnLoginDialogClosed:
1. Function OpenLoginDialog, getting called when the dialog gets opened, that is on a
mousedown-action on the button element.
This function reads the parameters of the opened dialog.

FUNCTION OpenLoginDialog : bool
VAR_INPUT
pClientData : POINTER TO VisuStructClientData;
END_VAR
VAR
dialogMan : IDialogManager;
loginDialog : IVisualisationDialog;
pLoginInfo : POINTER TO Login_VISU_STRUCT; // Login_VISU_STRUCT contains the
parameters defined in the interface of visualization "Login"
result : Visu_DialogResult;
stTitle : STRING := 'Login ...';
stPasswordLabelText: STRING;
stUserLabelText: STRING;
stUsername: STRING;
END_VAR

dialogMan := g_VisuManager.GetDialogManager(); // The DialogManager is
provided via the implicitly available VisuManager
IF dialogMan <> 0 AND pClientData <> 0 THEN
loginDialog := dialogMan.GetDialog('VisuDialogs.Login'); // dialog to be opened is
specified
IF loginDialog <> 0 THEN
pLoginInfo := dialogMan.GetClientInterface(loginDialog, pClientData);
IF pLoginInfo <> 0 THEN // in the following the parameters of the login dialog in
the Login_VISU_STRUCT will be read
pLoginInfo^.stTitle := stTitle;
pLoginInfo^.stPasswordLabelTxt := stPasswordLabelText;
pLoginInfo^.stUserLabelTxt := stUserLabelText;
dialogMan.OpenDialog(loginDialog, pClientData, TRUE, 0);
END_IF
END_IF
END_IF

Advertising