Forum: wxRuby Notebook Change Page Event Handling

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Norbert L. (Guest)
on 2012-05-17 00: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?
Alex F. (Guest)
on 2012-05-17 13: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
Norbert L. (Guest)
on 2012-05-17 19:28
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/sampl...
>
> alex

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

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