[fpc-pascal] Moving callbackfunctions to class

Darius Blaszyk dhkblaszyk at zeelandnet.nl
Fri Dec 31 01:53:31 CET 2010


I installed 2.5.1 just to test if it was possible to use static class methods or not. Apparently not so it seems. It was a good try, but it failed. Thanks anyway for the help and explanation Jonas.

It seems that GLut however offers a backdoor as was pointed out by honza. By using glutGetWindow, I can simply check in the main callback function which window paint method to handle. Thanks for the tip!

Regards, Darius


On Dec 30, 2010, at 6:35 PM, Jonas Maebe wrote:

> 
> On 30 Dec 2010, at 18:27, Darius Blaszyk wrote:
> 
>> The intention is indeed to create a wrapper around the multiple callback functions that GLut provides and additionally add some other methods and properties.
> 
> That is impossible since the callback does not offer any way to pass the self pointer.
> 
>> I have tried using a class method (FPC 2.4.2) but not static class methods, although I don't really understand what you mean with "you won't be able to access any fields from that one". Afaik class methods have a self, right?
> 
> static class methods don't have a self pointer. And furthermore, the "self" parameter of class methods refers to the VMT of the class type, not to the "self" of an instance.
> 
>> That would suggest you can access any method or property of self from a class method?
> 
> Not from a static class method. A static class method is basically a regular procedure/function declared in the scope of a class.
> 
> 
> Jonas_______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal




More information about the fpc-pascal mailing list