wxauinotebook get page to be closed

BlitzMax Forums/Brucey's Modules/wxauinotebook get page to be closed

UNZ(Posted 2013) [#1]
Hi,
I wasn't able to find something via google so I hope someone has an idea here.

The thing is that my wxauinotebook has close buttons on every page. I connect towxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE. It works so far. But how am I able to get the page to be closed from the event??? I tried every getter of the wxCommandEvent and none of 'em have any information about it. And the notebook itself neither.

I need this to ask the typical "are you sure you don't want to save before closing?" and to kill some references if the window is closed. I used the current selected window of the notebook for that but because I added wxAUI_NB_CLOSE_ON_ALL_TABS this is not effective anymore.


Brucey(Posted 2013) [#2]
It should probably raise a wxAuiNotebookEvent, rather than a wxCommandEvent.
Looks like a recent class that wasn't in the original implementation.


Brucey(Posted 2013) [#3]
I've added wxAuiNotebookEvent now.

From there, you should be able to query the event GetSelection(), which will return the index of the page to be closed.


UNZ(Posted 2013) [#4]
Can't cast event emitted by wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE to wxAuiNotebookEvent.


Brucey(Posted 2013) [#5]
Oh? I committed wxaui.mod changes, so it should work as expected. You will need to update your wx.mod, of course :-)


UNZ(Posted 2013) [#6]
Sure I did. (and I rebuild the module as well ^^)
But the event is derived from a wxCommandEvent.
You can check it with the aui example.




Brucey(Posted 2013) [#7]
Oh yes, you are correct. Problem fixed, and apologies!


UNZ(Posted 2013) [#8]
works now. thx