Forum: wxRuby Notebook Change Page Event Handling

Posted by 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?
Posted by 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
Posted by 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
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.