Forum: wxRuby Notebook Change Page Event Handling

E50d2ac925f5cf8403197c3cddd11d4b?d=identicon&s=25 Norbert Lange (lange_n)
on 2012-05-16 22:18
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?
06f6780c99d4a8dd71f2b474082ea9ce?d=identicon&s=25 Alex Fenton (Guest)
on 2012-05-17 11:23
(Received via mailing list)
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/sampl...

alex
E50d2ac925f5cf8403197c3cddd11d4b?d=identicon&s=25 Norbert Lange (lange_n)
on 2012-05-17 17:28
Alex Fenton 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/sampl...
>
> alex

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

Norbert
This topic is locked and can not be replied to.