MESSAGE
Route a method call to another Method
Syntax
MESSAGE <MessageName> METHOD <MethodName>( [<params,...>] ) MESSAGE <MessageName>() METHOD <MethodName>( [<params,...>] )
Arguments
<MessageName> The pseudo-method name to define
<MethodName> The method to create and call when <MessageName> is invoked.
<params, …> Optional parameter list for the method
Description
The MESSAGE command is a seldom-used feature that lets you re-route a call to a method with a different name. This can be necessary if a method name conflicts with a public function that needs to be called from within the class methods.
For example, your app may have a public function called BeginPaint() that is used in painting windows. It would also be natural to have a Window class method called :BeginPaint() that the application can call. But within the class method you would not be able to call the public function because internally methods are based on static functions (which hide public functions of the same name).
The MESSAGE command lets you create the true method with a different name (::xBeginPaint()), yet still allow the ::BeginPaint() syntax to call ::xBeginPaint(). This is then free to call the public function BeginPaint().
Examples
CREATE CLASS TWindow VAR hWnd, nOldProc METHOD New( ) CONSTRUCTOR MESSAGE BeginPaint METHOD xBeginPaint() ENDCLASS
Compliance
Harbour
Platforms
All
Seealso
METHOD, DATA, CLASS, Object Oriented Programming
Pingback: Harbour Statements | Viva Clipper !
Pingback: Harbour Commands | Viva Clipper !
Pingback: Harbour RG Summary | Viva Clipper !