|Re: swapping composites [message #449306 is a reply to message #449129]
||Thu, 20 January 2005 19:53
Originally posted by: wiz.vball.net|
Look at StackLayout
it allows you to create multiple controls that sit on top of each
other and using
stack.topControl = composite1;
stack.topControl = composite2;
you can switch between different composites and keep them in memory
you can keep an array of children composites and keep this as your
cache holder with the StackLayout set on the parent component...
then in your next or previous handlers you can check to see where you
are currently in the array and if the cache is full and you need a new
composite then simply remove one from the array (either from beginning
or end of array depending on whether going forward or backward) and
replace it with your new composite.
On Tue, 18 Jan 2005 15:43:58 -0000, "Andy Harrison"
>I'm writing a pocket pc application. I have a class which creates a GUI with
>two panels (Composites). The top composite is for displaying the pages from
>a form, the bottom is for next / previous buttons to swap between the pages
>of that form.
>I have worked out a procedure for swapping the form in the top panel. I got
>the idea from Snippet98, "Create and dispose of children of a composite.".
>when the "next" button is pressed...
>1. The next form page (composite) is created and attached to the shell
>2. This new page is passed into an object of the GUI class which:
>2.1. Disposes of the existing "previous" form
>2.2. Attaches new form to the GUI (by calling Composite.setParent)
>2.3. Refreshes the display as required
>My question is ... say I want to cache the pages of the form. Is it possible
>to have several Composites ready to drop in, but not visible or attached to
>anything? Say the user presses "previous" button - I can swap in the
>previous page and its state, including any data that was already typed in.
>Is this a useful thing to do anyway? I could keep a cache of a certain size
>so as not to use too many resources?
>Any comments would be appreciated. I am new to SWT and Java in general, so I
>am experimenting with ideas like this for my application. I did read that it
>is better to have one shell in a pocket pc app and to swap composites around
>(but maybe not like this!).
Powered by FUDForum
. Page generated in 0.01864 seconds