[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools] Re: Remove Page in Wizard Framework
|
- From: mhartley@xxxxxxxxxx (Matthew Hartley)
- Date: 14 Sep 2001 17:27:40 GMT
- Newsgroups: eclipse.tools
- Organization: http://www.eclipse.org
- User-agent: NewsPortal 0.23
Randy_Giffen@xxxxxxx wrote:
> > Well, I am dealing with dynamic data that changes and needs to be
> > presented to the user. If I could "add" a page its needed (basically
> add
> > the page when the user presses the next button) I could then dynamically
> > create the page and its controls. When the user presses back, I would
> > remove that page, so that everytime they press next on this particular
> > page they would get a new dynamic page added to the "pages" ArrayList.
> It
> > would make the wizard framework more versitile.
> >
> > What are you suggestions for doing page sequencing?
> Adding a page and creating its controls are two different steps.
> If you want to delay the creation of a page's controls until the page is
> needed, just override
> Wizard.createPageControls to not create that page. The WizardDialog will
> then create the page's
> controls just before it is made visible. Note that this may mean that the
> dialog will have to increase
> its size depending on the size of the page.
> You can determine what the next page is by overriding
> WizardPage.getNextPage().
> Thus you could show a new page each time next is pressed.
> I assume you truly need to create different controls each time and cannot
> simply reuse a page by updating the values and enablement of existing
> controls.
That is exactly what I will do. I will override getNextPage() and
getPreviousPage(), Thanks. But, before I can do that I am running into
another problem, and if I can't solve this problem then there is no need
for me to add pages dynamically or override the page flow. I am hoping
you can help shed some light on the other problem I am having. Here is
the deal: I need to add controls dynamicaly to a page, and the reason I
need to add them dynamically is because I won't know how many controls are
needed until the user inputs the neccessary items from the first page. At
that point, the user will press next, and then I can calculate how many
controls the user will need for the next page, then instantiate the next
page. This will all work, esspecailly using the technique of overriding
getNextPage(). But, the problem now is that how am I going to display the
controls, esspecially if they get to be so many that they all can't fit on
the same page. There are two solutions that I have been testing to deal
with this issue, one is to have one page that has some type of scrollable
composite, that will allow a user to scroll up and down on all the
contorls for that page. Or, two, keep adding pages, based on a minimum of
controls per page, until all controls have been displayed. Even if that
means having three or four pages. I really don't like the second choice,
mostly because there could end up being too many pages and being a
usability issue. So, I have been focusing on tyring to use one page that
has a scrollable composite. But, I can't get the composite to scroll the
controls. I have tried using scroll bars on just a regular composite, and
I have tried using the ScrolledComposite class. And niether of these are
working for me, at least within the Wizard framework. Here is the code I
am using for my second page to get this scroll thing to work:
public void createControl(Composite parent) {
ScrolledComposite sc = new ScrolledComposite(parent, SWT.H_SCROLL |
SWT.V_SCROLL);
Composite myComposite = new Composite(sc, SWT.NONE);
sc.setContent(myComposite);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
myComposite.setLayout(gridLayout);
Label [] label = new Label[15];
Text [] text = new Text[15];
for(int i = 0; i < 15; i++) {
button[i] = new Button(myComposite, SWT.CHECK);
label[i] = new Label(myComposite, SWT.NONE);
text[i] = new Text(myComposite, SWT.BORDER);
}
Point pt = myComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
myComposite.setSize(pt);
sc.setAlwaysShowScrollBars(true);
setControl(sc);
}
I have also tried different variations of setting sizes for the
composites, and what have you, and that hasn't worked either. Do you have
any suggestions?