Dynamic changes to a wizard page [message #336248] |
Wed, 03 June 2009 10:25  |
Eclipse User |
|
|
|
Hi everyone,
I have a wizard with a few pages in it and I am trying to dynamically
change the contents of a page based on the inputs of the previous page.
The issue I am having is how do you do this? createControl is only called
once at the beginning of the creation of the wizard, which doesn't help
because it isn't known at that time what the page will look like. In
essence all I want to do is have a textbox on one page allow you to enter
a number and then show that number of textboxes on the next page. Should
be simple, right?
Also, how do you trigger the page's "refresh"? It seems like getNextPage
is called twice per page, once when you enter the page and again when you
leave it.
I have searched all through this forum on dynamically changing wizard
pages but haven't been able to find a working example. If anyone has an
example that would be great!
Thanks,
Andy
|
|
|
Re: Dynamic changes to a wizard page [message #336252 is a reply to message #336248] |
Wed, 03 June 2009 12:44   |
Eclipse User |
|
|
|
Originally posted by: eclipse-news.rizzoweb.com
Andy wrote:
> Hi everyone,
>
> I have a wizard with a few pages in it and I am trying to dynamically
> change the contents of a page based on the inputs of the previous page.
> The issue I am having is how do you do this? createControl is only
> called once at the beginning of the creation of the wizard, which
> doesn't help because it isn't known at that time what the page will look
> like. In essence all I want to do is have a textbox on one page allow
> you to enter a number and then show that number of textboxes on the next
> page. Should be simple, right?
It seems like you could, in the page's createControl() method, just
create an empty Composite to hold the widgets, but not actually create
the Text widgets. Then override setVisible(boolean) on the page and in
there figure out how many widgets you need and create them.
I've used IDialogPage.setVisible(boolean) in a similar way before
(basically, I needed to enable/disable or show/hide parts of a page
based on the model state gathered on the previous page).
Hope this helps,
Eric
|
|
|
Re: Dynamic changes to a wizard page [message #336257 is a reply to message #336252] |
Wed, 03 June 2009 17:31   |
Eclipse User |
|
|
|
Thanks for the input. I tried adding
public void setVisible(boolean visible){
super.setVisibile(visible)
new Label(composite, SWT.NONE).setText("Do you see this");
}
in my WizardPage, but it didn't seem to display it to the WizardPage. The
only contents I saw were the ones that were added during the createControl
method. I put a print statement in and setVisible is indeed being called.
Also, composite is a class level variable and was instantiated in
createControl.
Is there some kind of forced refresh of the page that I need to do at the
end of setVisible?
Thanks,
Andy
|
|
|
Re: Dynamic changes to a wizard page [message #336261 is a reply to message #336257] |
Thu, 04 June 2009 02:54  |
Eclipse User |
|
|
|
Originally posted by: aurelien.pupier.esial.net
Hi,
answer below
Andy a écrit :
> Thanks for the input. I tried adding
> public void setVisible(boolean visible){
> super.setVisibile(visible)
> new Label(composite, SWT.NONE).setText("Do you see this");
> }
> in my WizardPage, but it didn't seem to display it to the WizardPage.
> The only contents I saw were the ones that were added during the
> createControl method. I put a print statement in and setVisible is
> indeed being called. Also, composite is a class level variable and was
> instantiated in createControl.
>
> Is there some kind of forced refresh of the page that I need to do at
> the end of setVisible?
>
Yes, I think that you have to do a .layout(true) on your parent composite.
> Thanks,
>
> Andy
>
|
|
|
Powered by
FUDForum. Page generated in 0.03172 seconds