I have a simple two page wizard application. The problem that I have is that the list of items in a wxChoice control on the second page needs to be different depending on what was chosen in a wxChoice control on the first page.
Looking at my code, its the same as here but it adds a wxChoice control:
http://aspn.activestate.com/ASPN/Mail/Message/wxpython-users/1559409
I can see that the problem is that the Wizard pages are created staticly before the wizard.RunWizard call provides the user a chance to make his first selection.
So now I wondering if making a Wizard was the right approach to the problem in the first place. Perhaps Wizards can't handle dynamic pages???
Anyway, what would be the easiest way to implement a simple application that uses the output of one wxChoice control to provide another wxChoice control that has its available selections determined the first control?
Specifically wxChoice #1 has "Happy Text" and "Sad Text". If the user chooses "Happy Text" then wxChoice #2 has "Smiles" and "Laughs". But if the user chooses "Sad Text" then wxChoice #2 has "Pain" and "Agony".
Here are the options that I have tried so far unsuccessfully...
Option1:
Modify my existing Wizard code so the second page is built dynamically. I don't this this is really an option as I look more and more at the Wizard code it seems to just be for static pages...
Option2:
My application is simple enough that it can easily all fit on a single page. The problem I had trying to implement this was that I am unsure how to put multiple wxChoice boxes on the same panel and get the event mapping hooked up right so that the second control is automatically updated when the user makes their selection in wxChoice #1....
Option3:
(Manual wizard) - just create a little app that pops one Dialog with the first wxChoice control, save the users selection then destroy the dialog and pop another Dialog with the second wxChoice control with the appropriate list. This seems to be the easiest and most straightforward option to me. But alas, being the wxPython newbie that I am I need a simple Dialog example to start from. Something along the lines of this
http://aspn.activestate.com/ASPN/Mail/Message/wxpython-users/1559409
simple wizard example that Robin so graciously provided me with earlier.
Anyone have any reccomendations one which approach/option is easier, or even better yet does anyone have a bit of sample code they could post that implements any one of these options?
Regards,
Darren
You could define a method GetChoiceResult() in your wizard page and call it from the next page via GetPrev().GetChoiceResult(), which yields the info you need to construct this second page. If your pages are inherited from wxPyWizardPage, you have to add the GetNext/SetNext/GetPrev/SetPrev yourself (see the examples).
martin
Darren Blaser wrote:
ยทยทยท
I have a simple two page wizard application. The problem that I have is that the list of items in a wxChoice control on the second page needs to be different depending on what was chosen in a wxChoice control on the first page.
Looking at my code, its the same as here but it adds a wxChoice control:
http://aspn.activestate.com/ASPN/Mail/Message/wxpython-users/1559409
I can see that the problem is that the Wizard pages are created staticly before the wizard.RunWizard call provides the user a chance to make his first selection.
So now I wondering if making a Wizard was the right approach to the problem in the first place. Perhaps Wizards can't handle dynamic pages???
Anyway, what would be the easiest way to implement a simple application that uses the output of one wxChoice control to provide another wxChoice control that has its available selections determined the first control?
Specifically wxChoice #1 has "Happy Text" and "Sad Text". If the user chooses "Happy Text" then wxChoice #2 has "Smiles" and "Laughs". But if the user chooses "Sad Text" then wxChoice #2 has "Pain" and "Agony".
Here are the options that I have tried so far unsuccessfully...
Option1:
Modify my existing Wizard code so the second page is built dynamically. I don't this this is really an option as I look more and more at the Wizard code it seems to just be for static pages...
Option2:
My application is simple enough that it can easily all fit on a single page. The problem I had trying to implement this was that I am unsure how to put multiple wxChoice boxes on the same panel and get the event mapping hooked up right so that the second control is automatically updated when the user makes their selection in wxChoice #1....
Option3:
(Manual wizard) - just create a little app that pops one Dialog with the first wxChoice control, save the users selection then destroy the dialog and pop another Dialog with the second wxChoice control with the appropriate list. This seems to be the easiest and most straightforward option to me. But alas, being the wxPython newbie that I am I need a simple Dialog example to start from. Something along the lines of this
http://aspn.activestate.com/ASPN/Mail/Message/wxpython-users/1559409
simple wizard example that Robin so graciously provided me with earlier.
Anyone have any reccomendations one which approach/option is easier, or even better yet does anyone have a bit of sample code they could post that implements any one of these options?
Regards,
Darren
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org