On IWAppFormCreate I set the Menu.MenuItems[15].visible:=true.
After the AutherEvent component on the ServerController calls the event OnCheck and in these event I call a function written into the UserSessionUnit and into them I call another function from my IWMainForm:
- Code: Select all
(FormMain as TfrmMain).UpdateMenu(g_iLivelloAutorizzazione);
On Debug when I execute the instruction "menuMain.MenuItems[15].Visible := true" into the MainForm function "UpdateMenu" on below, I see the Delphi Exception "Access Violation".
- Code: Select all
procedure TfrmMain.UpdateMenu(iLivelloAutorizzazione: Integer);
var
sCaption: string;
iCount: integer;
begin
try
if (iLivelloAutorizzazione = 1) then
menuMain.MenuItems[15].Visible := true
else
menuMain.MenuItems[15].Visible := false;
except
on e: exception do
begin
IWCGMessageDlg('ECCEZIONE: ' + e.Message, mtError, [mbOK],
procedure(Dialog: TIWCGJQMsgDialog; AResult: TModalResult)
begin
end);
end;
end;
end;
How is possible that in IWAppFormCreate my code is executed correctly and into the function UpdateMenu retrieve the exception?
Can you help me?
Thanks