> everything is ok. But I can also assign it using class name:
> CM.Callback := TContextMenu.ContextMenuSelect;
This is the way it's supposed to work in delphi mode, as far as I
remember Delphi allows it (disclaimer: I don't have Delphi now to check,
but it used to be so around Delphi 7).
This has actually one useful feature: when ContextMenuSelect is a "class
procedure", this is a safe and valid operation (class procedures can be
safely called by only a class reference, that's their point after all).
In objfpc I achieve the same by the unclean trick "CM.Callback :=
Unfortunately, the way it's implemented in delphi, it also allows this
very unsafe assignment when ContextMenuSelect is a normal (not class)
Re: Assigning class method to procedure of object via class name in delphi mode
2010/1/25 Michalis Kamburelis <[hidden email]>:
> This is the way it's supposed to work in delphi mode, as far as I
> remember Delphi allows it (disclaimer: I don't have Delphi now to check,
> but it used to be so around Delphi 7).
I see. I suspected as much, but wanted to make sure it's not a bug,
since I never used Delphi.