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
      CLASS TWindow
         DATA   hWnd, nOldProc
         METHOD New( ) CONSTRUCTOR
         MESSAGE BeginPaint METHOD xBeginPaint()
      ENDCLASS
Status

Ready

Compliance

MESSAGE is a Harbour extension.

Platforms

All

See Also