swapping composites [message #449129] |
Tue, 18 January 2005 10:43  |
Eclipse User |
|
|
|
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!).
thanks,
Andy
|
|
|
|
|
|
|
Re: swapping composites [message #449306 is a reply to message #449129] |
Thu, 20 January 2005 14:53  |
Eclipse User |
|
|
|
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;
or
stack.topControl = composite2;
you can switch between different composites and keep them in memory
(cache)...
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"
<andyh@agaricus.co.uk> wrote:
>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!).
>
>thanks,
>Andy
>
|
|
|
Powered by
FUDForum. Page generated in 0.04524 seconds