Wx:Wizard, Wx::WizardPageSimple

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 :slight_smile: (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!

Hi

EchoB wrote:

I got the splash screen working with a timer :slight_smile: (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