Jump to content

Create tunimenuitem dinamic in hyperserver


Wilton Ergon

Recommended Posts

I'm having trouble creating dynamic menus running on the hyperserver, when application runs as standalone, no problem occurs, someone is going through it, this also only occurs when the menu is created in a frame, and pointed to a tunimenubutton, when the menu is created on a form, not the problem.

 

I will try to create an example for support simulate this, the problem started after I put to run on hyperserver, I continue using the version 1552

i noticed several errors in the browser console, this does not occur in stand alone mode (in host location)

my code function in mainmodule!

PROCEDURE TUniMainModule.MontaArvoreLocalizacao(Menu:TuniMenuItem;somenteAtivos:boolean;selectreport:string);
var MenuRelatorio:TUniMenuItem;
    qPastas:TMSQuery;
BEGIN

 

  try
    qPastas            :=TMSQuery.Create(UniApplication);
    qPastas.Connection :=UniMainModule.dbsmain;
    qPastas.close;
    qPastas.SQL.Text :=selectreport;
    qPastas.Open;

    MenuRelatorio         :=TuniMenuItem.Create(UniApplication);
    MenuRelatorio.Caption :='-';
    UniMainModule.Global_ContadorMenu :=UniMainModule.Global_ContadorMenu+1;
    MenuRelatorio.Name    :='MenuItem'+IntToStr(UniMainModule.Global_ContadorMenu);
    UniMainModule.Global_ContadorMenu :=UniMainModule.Global_ContadorMenu+1;
    Menu.Add(MenuRelatorio);
    UniMainModule.Global_ContadorMenu :=UniMainModule.Global_ContadorMenu+1;
    while not qPastas.Eof do
      Begin
        MenuRelatorio         :=TuniMenuItem.Create(self);//UniApplication);
        MenuRelatorio.Caption :=qPastas.FieldByName('modulo').AsString+'| Qtde:'+qPastas.FieldByName('REG').AsString;
        MenuRelatorio.Name    :='MenuItem'+IntToStr(UniMainModule.Global_ContadorMenu);
        UniMainModule.Global_ContadorMenu :=UniMainModule.Global_ContadorMenu+1;
        menurelatorio.Hint    :=IIF(somenteAtivos,'1','0');
        MenuRelatorio.OnClick :=ExecClickRelatorioMenu;
        menurelatorio.Hint    :='MODULO';
        MenuRelatorio.Tag     :=0;
        Menu.Add(MenuRelatorio);
        qPastas.Next;
      End;
  finally
    freeandnil(qpastas);
  end;

end;

 

 

 

image.thumb.png.62a42eba4f1b71aafc0bd2e7ce16f801.png

 

 

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...