Talk:Main Loop Hooks

From Lazarus wiki
Revision as of 14:29, 27 April 2006 by Neli (talk | contribs) (reply to method of object question)
Jump to navigationJump to search

Why is it necessary for the TWaitHandleEvent procedure to be a method of an object? For my simple application it is a lot of unnecessary work to create a class, the method then an instance of it when all I want to do is call a procedure.

Ian Thompson-Bell

It enables OOP code, while not inhibiting pure procedural code; this would not be true the other way around when it would be a simple procedure pointer. Note that you need to define a class with your method, but you do not need to instantiate this class. @YourObject.CallbackMethod with YourObject of your type class and initialized to nil (or not initialized if you prefer) will work as long as you do not use Self in the CallbackMethod (and you don't).

neli 14:29, 27 Apr 2006 (CEST)