OLview052010

The OpenLaszlo <view>

May, 2010

Dear Fire Chicken,

We have the following code in our application to bring the debug console to
the front:

   Debug.console.bringToFront();

This used to work when we compile our application to swf8 in OL 4.2.0.3.
But does not work any more in OL 4.7.2. Changing the code to:


   Debug.console.window.bringToFront();

seems to work when compiling to swf8 in OL 4.7.2. Is this behavior changed in
OpenLaszlo 4.7.2?

- Gentle Reader

________________________________________________________________________________

Dear Gentle Reader,

No need to feel blue about your problem. You've stumbled upon one of the temptations of open source,
which is to read the source and end up relying on internal interfaces that you may have discovered.
The risk is that these internal interfaces may change in the next release, and you will be left with
a broken application. You need to exercise self-discipline to limit your dependence on internal
interfaces if you want a smooth transition to new versions of an open source project.

Now, to your particular problem:

Debug.console is a private property of the debugger (one of those internal interfaces I mentioned) and
should not be used by applications. The correct method for interacting with the 'in application'(see Note at bottom)
debug window is to give a name or id to the <debug> tag (which is also how you can specify
the size, placement, and initial state of the debug window). E.g.:

   <debug name="debugConsole" x="20" width="... />

Then you will be able to manipulate that window simply by using its name:

   debugConsole.bringToFront();

You could similarly, programmatically move the debug window: debugConsole.setAttribute('x', 200);

Or you could close the window if you don't need it: debugConsole.setAttribute('visible', false);

Note that in 4.7, you can also specify that the debug window initially be hidden: <debug ... visible="false" />

and it will automatically be made visible and frontmost any time there is new output to the debugger.
Similarly, you can close the debug window using the close button on the window and it will be re-opened and
made frontmost when there is new output.

Finally, in trunk, there is a new public API: Debug.ensureVisible();

that will make the debug window visible and frontmost without requiring any output.
(This change could easily be migrated to 4.7.3 if it would be helpful.)

I hope these hints will chase away your debugging blues!

--- Fire Chicken

Note: The debugger window that everyone knows and loves is just a window that runs in the same <canvas>
as your application. I call this the 'in application' debug window. We also support a 'remote' debug window, which is displayed in
a different canvas (or iframe in the case of the DHTML runtime) from your application. This can be useful if you believe that
your application and the debug window may be interacting in some way.