0

I want to add a click event to a menu item which is created at runtime.

In Oxygene

var mi : MenuItem := new MenuItem();

In C# this would have been something like

mi.Click += EventHandler(...);

However Oxygene does not seem to use the += operator. Events seem to have been specially treated in Oxygene in a way which is different to C#. What happens when I want to use the original C# event handling so I can use the MenuItem?

sav
  • 2,064
  • 5
  • 25
  • 45

1 Answers1

2

Click is an event. So

mi.Click += new EventHandler(@Click);

Works, or with a lambda:

mi.Click += (s, o) -> MessageBox.Show('Clicked the menu!');
Carlo Kok
  • 1,128
  • 5
  • 14