Jump to content

Problem on TNotifyEvent assigned at runtime on TUniMenuItem


sagt3k
 Share

Recommended Posts

Hi

I would assign an TNotifyEvent object to another object

T1.OnClick: = T2.OnClick;

T2.Onclick = TNotifyEvent is created directly on the program, and T1.OnClick is null, I would assign OnClick T2 to T1 or other events, but apparently does not work at RunTime T1.Onclick after I press the menu web T1.

How can I fix this?

Thanks

Link to comment
Share on other sites

Test case:

 

//T2 is created on MainMenu, and UniButton3 on MainForm

 

procedure TMainForm.T2Click(Sender: TObject);

begin

UniApplication.Terminate('')

end;

 

procedure TMainForm.UniButton3Click(Sender: TObject);

Var T:TUniMenuItem;

Begin

T:=TUniMenuItem.Create(UniApplication);

T.FreeOnRelease;

T.Name:='T1';

MainMenu.Items.Add(T);

T.OnClick:=T2.OnClick;

T.Visible:=True;

T.Enabled:=True;

T.Caption:='T1';

end;

 

The problem is that T1 is created at runtime, it does not work when pressed. In practice I have to create a dynamic menu at run time and assign events at runtime.

Thanks in advance for your support.

Link to comment
Share on other sites

T:=TUniMenuItem.Create(ApplMainForm);

 

OK I replaced, but it does not work the same. A doubt, but the main form when they are in 'vcl_session' or the web session is always 'ApplMainForm' ?

 

Where ApplMainForm is assigned as :

 

TApplMainForm = class(TUniForm)

....

function ApplMainForm: TApplMainForm;

....

Link to comment
Share on other sites

ApplMainForm is the name of my main Form.

 

ImageIndex would still appear to have a problem.

Thanks for the resolution of bugs.

I think, for us developers unigui is the final solution of web applications for Delphi. So also in our interest to help develop it.

 

Thanks

Link to comment
Share on other sites

Hey ... thanks works great!

It seems that you still know your secrets!

But given that I have at the same time and in the same form to load different menus,

how can I reset the menu and bring it to reset? Not enough to do.

Free and recreate it (MainMenu)? Could you help me?

 

Thanks !!!

Link to comment
Share on other sites

I use this code to reset mainmenu in 'vcl_session' works fine:

 

For I: = 0 to MainMenu.Items.Count-1 do

MainMenu.Items .Clear;

MainMenu.Items.Clear;

 

but 'web_session' no.

 

How do I can reset mainmenu?

 

Thanks

Link to comment
Share on other sites

Yes , I have tried it...

 

however, in attached the project,

 

in vcl_session it's OK, but in web_session does not work !!!

 

For me it is very important to convert a large project with unigui, and change the menu depending on the user profile is vital !!

 

Thanks

Link to comment
Share on other sites

Sorry about before, now attached the complete project. Let me explain, I developed a big management software in delphi and I would make the project a web. UniGui is perfect. So, I have a database where I created the tables PROFILE, USER, and MENU. Can I assign profiles to the USER and PROFILE MENU. In real time, while the user is working, the software is to analyze the profile and in the case is to add or remove menu items without having to shut down or restart the MainForm. It would be possible to change the database and edit the menu in real time, of course, any form or by closing the open frame.

uniguimenu.zip

Link to comment
Share on other sites

No I'm using version 0.87 with DELPHI XE2 never update. The problem is that I'm working with a PC that is not my office and have not done the updates of DELPHI XE2, so I can't install version 0.88 because of the need to update. Personally I have my licensed version of Delphi 7, but UNIGUI not work with this :( Anyway, now I know why it did not work. Thanks, thanks you.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...