# Closing event on a Notebook page

**URL:** <https://www.ruby-forum.com/t/closing-event-on-a-notebook-page/180116>\
**Category:** wxRuby\
**Created:** [December 11, 2009, 11:25pm UTC](https://www.ruby-forum.com/t/closing-event-on-a-notebook-page/180116 "2009-12-11T23:25:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Svend\_Haugaard\_SSSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@Svend\_Haugaard\_SSSS](https://www.ruby-forum.com/u/Svend_Haugaard_SSSS)\
**Post date:** [December 11, 2009, 11:25pm UTC](https://www.ruby-forum.com/t/closing-event-on-a-notebook-page/180116/1 "2009-12-11T23:25:31Z")

</div>

How do I catch a closing event for a Notebook page.

I have added a number of pages (class Panel) to a Notebook and I  
can remove them via the default close button on the pane.  
But I what to run some code before the page(Panel) is closed,  
so I assumed that it gets a ‘evt\_close’, but that seems not to be  
the case.

How do I get to run some code before the page(Panel) closes?

---

<div class="post-metadata">

**Author:** ![Svend\_Haugaard\_SSSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@Svend\_Haugaard\_SSSS](https://www.ruby-forum.com/u/Svend_Haugaard_SSSS)\
**Post date:** [December 14, 2009, 10:02pm UTC](https://www.ruby-forum.com/t/closing-event-on-a-notebook-page/180116/2 "2009-12-14T22:02:16Z")

</div>

Svend Haugaard Sørensen wrote:

> I have added a number of pages (class Panel) to a Notebook and I  
> can remove them via the default close button on the pane.  
> But I what to run some code before the page(Panel) is closed,  
> so I assumed that it gets a ‘evt\_close’, but that seems not to be  
> the case.
> 
> How do I get to run some code before the page(Panel) closes?

As far as I know, individual pages within the standard Wx::Notebook  
can’t be closed via the user interface, only programmatically. There  
aren’t individual ‘close’ buttons on each pane for the user to do this.

If you’re using Wx::AuiNotebook for this, which does have IDE-like tabs  
with their own close buttons, then there is an event specifically for  
this, something like evt\_auibook\_page\_closing - have a look at the aui  
sample to check the name.

a

---

<div class="post-metadata">

**Author:** ![Svend\_Haugaard\_SSSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@Svend\_Haugaard\_SSSS](https://www.ruby-forum.com/u/Svend_Haugaard_SSSS)\
**Post date:** [December 15, 2009, 4:31am UTC](https://www.ruby-forum.com/t/closing-event-on-a-notebook-page/180116/3 "2009-12-15T04:31:30Z")

</div>

On Mon, 14 Dec 2009 21:02:05 +0000  
Alex F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> can’t be closed via the user interface, only programmatically. There  
> aren’t individual ‘close’ buttons on each pane for the user to do  
> this.
> 
> If you’re using Wx::AuiNotebook for this, which does have IDE-like  
> tabs with their own close buttons, then there is an event  
> specifically for this, something like evt\_auibook\_page\_closing - have  
> a look at the aui sample to check the name.

Ahh, I didn’t know the where 2 different NoteBooks classes, that  
explain my problems.

Thanks for the help.
