Hi Pierre, Dick
The reason for the 2520 ibeam is to separate the interpreter's Windows message queue from the GUI application's queue. If both the interpreter and the GUI use the same message queue, then "oddness" can ensue. The most frequent oddness is the interpreter retrieving (and then processing) a message for the GUI when the GUI is not expecting it. For example, the interpreter processes a keypress message for the GUI when the GUI is already in the middle of a keypress callback. This usually (but not always - it depends on the object) manifests in the message "An Exception occurred at a time when Dyalog was unable to save the exception information". The underlying exception contains more relevant information, but the interpreter does not have access to this information when the exception was raised.
The 2520 ibeam configures the interpreter to use a different thread (and thus a different message queue) for .Net code run from APL thread 0 (note that the interpreter already does this for other APL threads). The ibeam should be used before you execute any .NET code on any thread.
This addresses the above issue, but brings with it another set of considerations.
- GUI created in this mode can only be accessed from thread 0. Attempting to access the GUI from other APL threads results in the exception "The calling thread cannot access this object because a different thread owns it."
- The GUI will only process its message queue when you call a (.NET) function that causes it to do so (such as Show, or ShowDialog). When the interpreter is at a 6 space prompt, it is only processing its own message queue - not that of the GUI. This means that:
- Any action in the GUI that requires message handling is stalled until the such a function is called. I suspect that the Navigate function of the webbrowser uses the windows message queue during communication, and so this is stalled. So the Document property gives VALUE ERROR because there is no document (yet)
Dick, if you have an example of your exception that the above does not explain, then please let us have it.
Best Regards
John Daintree.