Difference between revisions of "Talk:Main Loop Hooks"

From Lazarus wiki
 
(reply to method of object question)
Line 2: Line 2:
  
 
Ian Thompson-Bell
 
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).
 +
[[User:Neli|neli]] 14:29, 27 Apr 2006 (CEST)

Revision as of 14:29, 27 April 2006

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)