Talk:Third-Party Help Menu Item (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

In the page, you wrote:

   MyHelpMenuItem.Caption := 16;
   MyHelpMenuItem.ImageIndex := 'My Company';

Instead, it must be:

   MyHelpMenuItem.Caption := 'My Company';
   MyHelpMenuItem.ImageIndex := 16;

the provided code does not compile

the provided code does not compile, because this assignment -> MyOnlineHelpMenuItem.OnClick := OnlineHelpClick; is not allowed.

instead:

1. declare a TMethodContainer = class(TObject), like:

 TMethodContainer = class(TObject)
   procedure OnlineHelpClick(Sender: TObject);
 end;

2. create an instance of it in procedure Initialize(Sender: TObject);, like:

   aMethodContainer := TMethodContainer.Create;

3. assign MyOnlineHelpMenuItem.OnClick with:

   MyOnlineHelpMenuItem.OnClick := aMethodContainer.OnlineHelpClick;

I can send the complete refactored unit if required

Response

Hi Didier Cabale,

Thank you very much for pointing out this error in our documentation. I have updated the code on this page per your comment: Third-Party Help Menu Item (Delphi).

Would you be so kind and verify that I have added the best solution? I have tried it and it works, but I am not a professional programmer so your solution may be better.

You can provide feedback about a specific wiki page also by using the link "Help Feedback" on the bottom of a page or writing directly to documentation@embarcadero.com.

Best regards,

Danijelp --30.09.2015--

Response

Hi Danijelp,

I precised the requirements of my first post, directly in the message. (It is needed to create the TMethodContainer). You would be kind to modify.

This modified code should work, but I'll send you later a cleaner code. Best regards.

Didier