Hi,

When reading 
https://www.freepascal.org/docs-html/ref/refsu31.html#x82-1040006.5.7 I 
stumbled on the following text at the bottom of the page:

"In addition to this mechanism, a string message method accepts a self 
parameter:
Procedure StrMsgHandler(Data: Pointer;  
                        Self: TMyObject); Message ’OnClick’;

When encountering such a method, the compiler will generate code that loads the 
Self parameter into the object instance pointer. The result of this is that it 
is possible to pass Self as a parameter to such a method.

Remark: The type of the Self parameter must be of the same class as the class 
the method is defined in."

1. This code snippet fails to compile with the message "Message handlers can 
take only one call by ref. parameter" (revision 30487, $mode objfpc)
2. "[...] When encountering such a method, [...]": What are the exact criteria: 
the parameter name, the parameter type, ...?
3. Can anybody explain what the part "The result of this is that it is possible 
to pass Self as a parameter to such a method." entails? How can it be passed 
with DispatchStr?
4. Can somebody give an example on how to use this functionality?

-- 
Ewald
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to