| Home | Previous Lesson: KeyDown(), GetObjectAtPointer() Next Lesson: Closing the Debug Window |
To pass values between windows, you often use message object. Like KeyDown(), this works well at run-time. Typically while debugging, you go through the code step-by-step, watching the variables and trying to figure out what's happening. Unfortunately, by using this method of debugging, you are allowing time between execution of the lines, a result that it-self produces adverse effects.
Windows is a message-based operating system. This means every application working under Windows sends and receives messages. When there is time left before you execute the line that checks the value of the message object, there is a chance that other application messages may override its content. This leaves the script without the required content of the message object.
At runtime, as there is no intervention in most cases, it works as you would want it to.
To overcome this problem, declare a local or instance variable in the called event (triggered event) and assign to it the message object value in the first statement of the event itself. For example:
// CommandButton cb_browse in WindowA
OpenWithParm( WindowB, "String Value" )
In the Open event of WindowB, you would then add the following line of code as the first line:
InstanceStringVariable = Message.StringParm
| Home | Previous Lesson: KeyDown(), GetObjectAtPointer() Next Lesson: Closing the Debug Window |