PDA

View Full Version : Resizing a window


jpan
04-13-2004, 06:19 AM
Hi,

In the Dashboard, I put in a view (well, an instantiation of a class) that replaces the Entertainment image.

<MapPanel x="2" y="20" width="${immediateParent.width-4}" height="${immediateParent.height-20}" />

This works great, since it resizes automatically as the user resizes the dash window.

However, as the user resizes the dash window, I need to capture the event and send the new window size to a server. How can I capture this event? As far as I understood, the resize state is applied and then removed. I basically need to be notified when it is removed. How can I do this? Or, is there a better way??

Thank you very much!

antun
04-13-2004, 08:39 AM
You're absolutely right here, except that the dashboard code doesn't use the standard <resizestate>, instead it uses a custom one.

That's not a big deal at all - the state class sends onapply and onremove events. You can have any method listen for an event with the syntax:


<method event="onfoo" reference="myview">


... where onfoo is the name of the event (onapply/onremove) and myview is a pointer to the view that is going to send the event. Actually, in this case, it's not even a view - it's a state that's sending the event. So if you wanted to put your method in the canvas, you could do this:


<method event="onremove" reference="dailyContent.resizer">
Debug.write( "Daily Content Window has been resized!" );
</method>


You could also put the method inside the instance of the dashWindow class and reference it more locally.

-Antun


How can I capture this event? As far as I understood, the resize state is applied and then removed. I basically need to be notified when it is removed. How can I do this? Or, is there a better way??

jpan
04-13-2004, 08:52 AM
Yeah, silly me. You gave the exact same solution earlier for my slider question!

I actually did exactly that, and it worked out pretty well! Thank you very much!