CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Access violation on Menu.Menuitems[x].visible:=true

by feland » 04 Jul 2017 13:33

Hi,
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
feland
 
Posts: 89
Joined: 15 Jun 2015 15:12

by Alexander Bulei » 04 Jul 2017 14:14

Hi feland,

Debug it in your side...maybe your main form is nil or on creation...

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal


Return to JQMenu

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.