MESSAGE

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

Advertisements

3 responses to “MESSAGE

  1. Pingback: Harbour Statements | Viva Clipper !

  2. Pingback: Harbour Commands | Viva Clipper !

  3. Pingback: Harbour RG Summary | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s