Notebook Change Page Event Handling

I’m still a bit new to Ruby, but have been using WxRuby for a couple of
months now. I’ve created a notebook with a few pages, and am having a
tough time understanding how to implement an event handler that would
get called whenever the page gets changed.

Would someone be kind enough to post a simple example?

hi

On 16/05/12 21:18, Norbert Lange wrote:

I’m still a bit new to Ruby, but have been using WxRuby for a couple of
months now. I’ve created a notebook with a few pages, and am having a
tough time understanding how to implement an event handler that would
get called whenever the page gets changed.

Welcome to wxRuby. There are two events : evt_notebook_changing and
evt_notebook_changed. They receive a Wx::NotebookEvent, and the former
can be veto-ed if you want to prevent the change.

There’s an example within the bigdemo sample:
http://wxruby.rubyforge.org/svn/trunk/wxruby/samples/bigdemo/wxNotebook.rbw

alex

Alex F. wrote in post #1061104:

hi

On 16/05/12 21:18, Norbert Lange wrote:

I’m still a bit new to Ruby, but have been using WxRuby for a couple of
months now. I’ve created a notebook with a few pages, and am having a
tough time understanding how to implement an event handler that would
get called whenever the page gets changed.

Welcome to wxRuby. There are two events : evt_notebook_changing and
evt_notebook_changed. They receive a Wx::NotebookEvent, and the former
can be veto-ed if you want to prevent the change.

There’s an example within the bigdemo sample:
http://wxruby.rubyforge.org/svn/trunk/wxruby/samples/bigdemo/wxNotebook.rbw

alex

Thanks Alex. That’s exactly what I was looking for.

Norbert