[Lazarus] Add a MenuItem to a menu dynamically -> OnClick: wrong number parameters

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Wed Mar 11 17:46:02 CET 2015

On 2015-03-11 16:39, Felipe Monteiro de Carvalho wrote:
>    MyItem.OnClick:=@MyPopUp;
>    MySubItem1.OnClick:=@MyPopUp;

More specifically... it depends of the compiler mode. Is the source code
shared between Lazarus and Delphi? If so you probably want to use the
delphi mode at the top of the unit. Then no @ prefix is required.
  {$mode delphi}

If the code is Lazarus only, then you probably want the objfpc mode - at
which point you need to add the @ prefix to the event handler as quoted
  {$mode objfpc}

  - Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal

More information about the Lazarus mailing list