# Notebook page changed event

**URL:** <https://www.ruby-forum.com/t/notebook-page-changed-event/235823>\
**Category:** wxRuby\
**Created:** [July 17, 2013, 11:26pm UTC](https://www.ruby-forum.com/t/notebook-page-changed-event/235823 "2013-07-17T23:26:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [July 17, 2013, 11:26pm UTC](https://www.ruby-forum.com/t/notebook-page-changed-event/235823/1 "2013-07-17T23:26:34Z")

</div>

I’m having a bit of a problem with the notebook page changed event. I  
would like to have a page change trigger a refresh of data for the page  
that is currently selected (the one that’s been changed to).

In each of the notebook pages, I’ve added a panel that has an object  
associated with it, and on a page changed event, I’d like each panel to  
check if it’s currently the one that’s visible. The problem that I’m  
finding is that the panel that thinks it’s visible is the one that we  
just came from, not the one in the panel that we changed to.

Should the evt\_notebook\_page\_changed event fire after we’ve changed to  
the new page and it is visible?

Norbert

---

<div class="post-metadata">

**Author:** ![norbertl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/c77e96/32.png) [@norbertl](https://www.ruby-forum.com/u/norbertl)\
**Post date:** [August 2, 2013, 4:02pm UTC](https://www.ruby-forum.com/t/notebook-page-changed-event/235823/2 "2013-08-02T16:02:36Z")

</div>

Bonjour,

Je suis actuellement en conges. Je prendrai connaissance de votre  
message a partir du 19 aout et vous contacterai des que possible.

Cordialement

---

<div class="post-metadata">

**Author:** ![norbertl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/c77e96/32.png) [@norbertl](https://www.ruby-forum.com/u/norbertl)\
**Post date:** [August 2, 2013, 4:13pm UTC](https://www.ruby-forum.com/t/notebook-page-changed-event/235823/3 "2013-08-02T16:13:43Z")

</div>

Bonjour,

Je suis actuellement en conges. Je prendrai connaissance de votre  
message a partir du 19 aout et vous contacterai des que possible.

Cordialement

---

<div class="post-metadata">

**Author:** ![norbertl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/c77e96/32.png) [@norbertl](https://www.ruby-forum.com/u/norbertl)\
**Post date:** [August 2, 2013, 5:30pm UTC](https://www.ruby-forum.com/t/notebook-page-changed-event/235823/4 "2013-08-02T17:30:51Z")

</div>

Hi Norbert,

evt\_notebook\_page\_changed get called after the page has been changed.

To get the current selected page use

evt.selection method (where evt is the event object passed to the  
evt\_notebook\_page\_changed)  
.  
it returns the number of currently selected page (starting from 0)

I use it something like the following:

```
def listbook_page_changed(evt)
  begin
    case evt.selection
    when Helpers::ApplicationHelper::ANAGRAFICA_VIEW
      anagrafica_notebook_mgr.current_page().init_panel()
    when Helpers::ApplicationHelper::FATTURAZIONE_VIEW
      fatturazione_notebook_mgr.current_page().init_panel()
    .....
    end

  rescue Exception => e
    logger.error(e.message)
  end

  evt.skip()
end

```

hope this help.

Fabio.

---

<div class="post-metadata">

**Author:** ![norbertl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/c77e96/32.png) [@norbertl](https://www.ruby-forum.com/u/norbertl)\
**Post date:** [August 2, 2013, 6:10pm UTC](https://www.ruby-forum.com/t/notebook-page-changed-event/235823/5 "2013-08-02T18:10:34Z")

</div>

Bonjour,

Je suis actuellement en conges. Je prendrai connaissance de votre  
message a partir du 19 aout et vous contacterai des que possible.

Cordialement
