Message object

The Message object is used to process events that are not defined by PowerBuilder, to communicate parameters between windows when you open and close them, and to specify whether optional parameters are used in TriggerEvent or PostEvent.

You can also customize your own version of the Message object by defining a class user object inherited from the built-in Message object.

For more information about creating a custom Message object, see the section called “Working with User Objects” in Users Guide.

Properties

The first four properties of the Message object correspond to the first four properties of the Microsoft Windows message structure:

Message property

Datatype

Description

Handle

Long

The handle of the window or control.

Number

UnsignedInt

The number that identifies the event (this number comes from Windows).

WordParm

Long

The word parameter for the event (this parameter comes from Windows). The parameter's value and meaning are determined by the event.

LongParm

Long

The long parameter for the event (this number comes from Windows). The parameter's value and meaning are determined by the event.

ClassDefinition

PowerObject

An object of type PowerObject containing information about the class definition of the object or control.

DoubleParm

Double

A numeric or a numeric variable.

StringParm

String

A string or a string variable.

PowerObjectParm

PowerObject

Any PowerBuilder object type including structures.

Processed

Boolean

A boolean value set in the script for the user-defined event or the Other event. Values are:

TRUE -- The script processed the event; do not call the default window process (DefWindowProc) after the event has been processed.

FALSE -- (Default) Call DefWindowProc after the event has been processed.

ReturnValue

Long

When Message.Processed is true, specifies the value you want returned to Windows. This property is ignored when Message.Processed is false.


Events

Message event

Occurs

Constructor

When the user object is created

Destructor

When the user object is destroyed


Functions

Message function

Datatype returned

Description

ClassName

String

Returns the name assigned to the user object

GetContextService

Integer

Creates a reference to a context-specific instance of the specified service

GetParent

PowerObject

Returns a reference to the name of the parent object

PostEvent

Boolean

Adds an event to the end of the message queue of the user object

TriggerEvent

Integer

Sends an event to the user object and executes the script associated with the event

TypeOf

Object

Returns the type of the user object