VCL events with anonymous methods - what do you think about this implementation?

后端 未结 3 1478
梦谈多话
梦谈多话 2021-02-13 03:57

Since anonymous methods appeared in Delphi I wanted to use them in VCL components events. Obviously for backward compatibility the VCL wasn\'t updated, so I managed to make a si

3条回答
  •  抹茶落季
    2021-02-13 04:47

    You could make TNotifyEventDispatcher to be a subclass of TInterfacedObject so you do not need to care about freeing it.

    But to be more pragmatic one would use traditional event assignment that takes less lines of code and is supported by the IDE.

提交回复
热议问题