Re: [fpc-pascal] Moving callbackfunctions to class

2010-12-30 Thread Darius Blaszyk
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,

Re: [fpc-pascal] constant records as default parameters

2010-12-30 Thread Howard Page-Clark
On 30/12/10 7:40, David Emerson wrote: I'd like to use a constant record as a default parameter. Is there some way to do this? Here's my use case: type lt_ints = record left, top : longint; end; const lt_zero : lt_ints = (left:0; top:0); procedure do_something (const offset_lt

Re: [fpc-pascal] commutative operators

2010-12-30 Thread David Emerson
Mark Morgan Lloyd wrote: > Can I have a reality check on this please: in this context is the > overloaded := effectively an implicit cast as well as an explicit operator? looks like. Below is some sample code which illustrates the fact. > Is the availability of overloaded + and := operators nece

[fpc-pascal] constant records as default parameters

2010-12-30 Thread David Emerson
I'd like to use a constant record as a default parameter. Is there some way to do this? Here's my use case: type lt_ints = record left, top : longint; end; const lt_zero : lt_ints = (left:0; top:0); procedure do_something (const offset_lt : lt_ints = lt_zero); The procedure declar

Re: [fpc-pascal] commutative operators

2010-12-30 Thread Mark Morgan Lloyd
Honza wrote: 2010/12/29 David Emerson : On Wed 29 Dec 2010, Honza wrote: IIRC you don't have to. well... I do have to. I get "can't determine which overloaded function to call" because I have a lot of similar-looking functions and := operators You're right, I verified it just now. I didn't re

Re: [fpc-pascal] Moving callbackfunctions to class

2010-12-30 Thread Jonas Maebe
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 poi

Re: [fpc-pascal] Moving callbackfunctions to class

2010-12-30 Thread Darius Blaszyk
On Dec 30, 2010, at 6:09 PM, michael.vancann...@wisa.be wrote: > > > On Thu, 30 Dec 2010, Jonas Maebe wrote: > >> >> On 30 Dec 2010, at 17:34, Darius Blaszyk wrote: >> >>> As these functions are needed per window, I would like to encapsulate each >>> window in a class something like: >>> >

Re: [fpc-pascal] Moving callbackfunctions to class

2010-12-30 Thread michael . vancanneyt
On Thu, 30 Dec 2010, Jonas Maebe wrote: On 30 Dec 2010, at 17:34, Darius Blaszyk wrote: As these functions are needed per window, I would like to encapsulate each window in a class something like: TMyGLutWindow = class private procedure MyDisplayFunc; cdecl; public constructor Cre

Re: [fpc-pascal] Moving callbackfunctions to class

2010-12-30 Thread Jonas Maebe
On 30 Dec 2010, at 17:34, Darius Blaszyk wrote: > As these functions are needed per window, I would like to encapsulate each > window in a class something like: > > TMyGLutWindow = class > private >procedure MyDisplayFunc; cdecl; > public >constructor Create; > end; > > In the constr

Re: [fpc-pascal] Moving callbackfunctions to class

2010-12-30 Thread Honza
2010/12/30 Darius Blaszyk : > Though I understand the error, I do not know if there is a way to circumvent > this? I guess: In the callback you have to get the current window id using glutGetWindow, then dispatch the call to the right object instance using that id via some kind of mapping from wind

Re: [fpc-pascal] Moving callbackfunctions to class

2010-12-30 Thread Michael Van Canneyt
On Thu, 30 Dec 2010, Darius Blaszyk wrote: Hi, GLut defines callback functions, one of them is the display function, which is defined as: TGlutVoidCallback = procedure; cdecl; This is set by calling glutDisplayFunc(@MyDisplayFunc);  As these functions are needed per window, I would like t

[fpc-pascal] Moving callbackfunctions to class

2010-12-30 Thread Darius Blaszyk
Hi, GLut defines callback functions, one of them is the display function, which is defined as: TGlutVoidCallback = procedure; cdecl; This is set by calling glutDisplayFunc(@MyDisplayFunc); As these functions are needed per window, I would like to encapsulate each window in a class something

Re: [fpc-pascal] commutative operators

2010-12-30 Thread David Emerson
On Wed 29 Dec 2010, Jetcheng Chu wrote: > I think you need to make sure that `a' and `b' are in the same algebraic > system before making the commutativity of the operator meaningful. You know, that makes a lot of sense. I should have thought about it that way before asking. Thanks. ~David. ___