| Home | Previous Lesson: Structures Next Lesson: Calling Functions |
Till now we talked about sending parameters to the window while opening it, but how does the opened window access those parameters? It is possible by the Message object. When you use functions like OpenWithParm(), the parameter value is stored in a Message object. A Message object is a built-in global object that can be used as a carrier for the parameter. You can send one of the following data types through the Message object:
|
Data Type |
Stored in |
|
String |
Message.StringParm |
|
Numeric |
Message.DoubleParm |
|
PowerBuilder Object |
Message.PowerObjectParm |
The parameter is stored in the relevant Message object attribute, depending on the data type of the parameter. You can then refer to the parameter in the calling object by using the Message. notation. For example:
// DataWindow idw_2_save //Instance variable
idw_2_save = Message.PowerObjectParm
A possible problem associated with the Message object is that, all currently running applications can generate messages, so there is a chance of the Message object being overwritten.
A solution to this problem is, to declare an instance or local variable in the called object and then in the very first statement of the object's open event, assign this variable with the Message object attribute.
| Home | Previous Lesson: Structures Next Lesson: Calling Functions |