# Wx:Wizard, Wx::WizardPageSimple

**URL:** <https://www.ruby-forum.com/t/wx-wizard-wx-wizardpagesimple/124395>\
**Category:** wxRuby\
**Created:** [December 28, 2007, 9:23am UTC](https://www.ruby-forum.com/t/wx-wizard-wx-wizardpagesimple/124395 "2007-12-28T09:23:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![EchoB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/45deac/32.png) [@EchoB](https://www.ruby-forum.com/u/EchoB)\
**Post date:** [December 28, 2007, 9:23am UTC](https://www.ruby-forum.com/t/wx-wizard-wx-wizardpagesimple/124395/1 "2007-12-28T09:23:22Z")

</div>

Ok, here is my class:  
#====================================  
class SetupWizard \< Wx::Wizard  
def initialize(timefly, title)  
setup\_image = Wx::Bitmap.new(“wizard\_side.png”,  
Wx::BITMAP\_TYPE\_PNG)  
super(nil, -1, title, setup\_image)  
@timefly = timefly

```
 step_one = Wx::WizardPageSimple.new()
 setup_page_one(step_one)
 step_two = Wx::WizardPageSimple.new(nil, step_one)
 step_one.set_next(step_two)
 setup_page_two(step_two)

 run_wizard(step_one)
 #self.show(true)

```

end

def setup\_page\_one(step)  
intro\_label =  
“some  
text  
here”  
Wx::StaticText.new(step, :label =\> intro\_label)  
end

def setup\_page\_two(step)  
label =  
“more  
text here”  
Wx::StaticText.new(step, :label =\> label)  
txt = Wx::TextCtrl.new(step,  
:id =\> 21,  
:value =\> @timefly.running\_path+“log”,  
:style =\> Wx::TE\_READONLY,

```
                         :size => Wx::Size.new(270,-1),
                         :pos => Wx::Point.new(0, 140),
                         :name => "step2path")
 btn_change_path = Wx::Button.new(step,
                                   :id =>22,
                                   :label => 'Change',
                                   :pos => Wx::Point.new(0, 163),
                                   :name => "btn_change_path")

 evt_button(22) {|evt| on_change_logpath(evt)}
 btn_default_path = Wx::Button.new(step,
                                   :id =>22,
                                   :label => 'Default',
                                   :pos => Wx::Point.new(80, 163),
                                   :name => "btn_default_path")

```

end

def on\_change\_logpath(evt)  
print “change logpath!”  
end  
end  
#====================================  
#here is the call from within another class:  
#====================================  
…  
SetupWizard.new(@timefly, “TimeFly Setup”)  
…  
#====================================  
I got the splash screen working with a timer 🙂 (see previous post:  
Wx::SplashScreen, and events)

## Let me qualify the above code by saying that it originally inherited from Wx::Frame, and I made a new Wx:Wizard with the self (Wx::Frme) as parent. But I was having a problem where NO events were firing when I intereacted with the controls on each WizardPageSimple.

So I decided to try and see if making the whole thing inherit Wx::Wizard  
and set parent window to nil works any better. Well - now I see the  
wizard for just under half a second, and it never comes back. The ruby  
runtime continues though - and I get no error messages.

What did I miss?  
HALP!

---

<div class="post-metadata">

**Author:** ![EchoB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/45deac/32.png) [@EchoB](https://www.ruby-forum.com/u/EchoB)\
**Post date:** [December 28, 2007, 3:47pm UTC](https://www.ruby-forum.com/t/wx-wizard-wx-wizardpagesimple/124395/2 "2007-12-28T15:47:37Z")

</div>

Hi

EchoB wrote:

> I got the splash screen working with a timer 🙂 (see previous post:  
> Wx::SplashScreen, and events)

Cool.

> Let me qualify the above code by saying that it originally inherited  
> from Wx::Frame, and I made a new Wx:Wizard with the self (Wx::Frme) as  
> parent.  
> …  
> So I decided to try and see if making the whole thing inherit Wx::Wizard  
> and set parent window to nil works any better.  
> Generally, take a look at the bundled samples/etc/wizard.rb. This  
> illustrates how to set up a simple wizard and how to handle the events  
> that are fired as the user proceeds through the pages.

It appears that from the documentation, Wx::Wizard must have valid  
parent Frame; unlike some other top-level windows, nil is not permitted.  
Note that the parent frame doesn’t necessarily have to be shown, if you  
want to run through a wizard without anything else appearing at that  
point (eg for an initial setup routine).

More importantly, using the debug build, I get failures unless each  
WizardPageSimple constructor is passed the containing wizard (self) as  
its first parameter. With that done, your sample works fine for me.

I am not sure why the current wxWidgets documentation seems to suggest  
that nil is allowed for a WPS parent.

> Well - now I see the  
> wizard for just under half a second, and it never comes back. The ruby  
> runtime continues though - and I get no error messages.

There are some mistakes in Wx programming that are flagged as assertion  
failures, but only show up in a debug build of wxWidgets; in a release  
build they either just don’t work or occasionally segfault. However the  
debug build is much bigger and slower than the release build, so we base  
all the distributed gems on release.

If something isn’t quite working, take a second look at the docs and  
samples, and you’re very welcome to ask on here.

best wishes  
aelx
