Friday, March 24, 2006

options=ignorelayout

I am experimenting with a homemade OpenLaszlo class that is used entirely for audio. Let's call it AudioClass. Naturally, it frequently has setSource('blah.mp3') called on it.

This class has no visible GUI elements, but it is a subview of other classes which do have GUI elements, like buttons and so on.

I had the problem that whenever setSource was called, the GUI elements in the parent view would shift up and down slightly, as if making room for something, but then dropping back to their original positions. It was making me nuts. I tried setting the AudioClass height and width to zero, setting visible to false, and so on. Anything to make this class essentially not visible to the rest of the application, so it would not affect the layout. No luck, buttons kept moving.

Finally I found the answer, sort of by accident: use options=ignorelayout in AudioClass. The ignorelayout option is explained in the Guide, although I feel the explanation is poor, and how it works in my case is not explained.

I found this solution by searching the OpenLaszlo forums for "setSource problems" in the hopes of finding someone else with this exact problem. Instead I found that Shelby had posted some sample code for a media player which did not exhibit my problem; the options=ignorelayout attribute had been set there.

Hooray for forums, and kudos to Shelby for taking the time to post!

0 Comments:

Post a Comment

<< Home