I'm playing with wx.aui.notebook and can't find a demo example which shows how to track which tab is being closed. I can bind wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE, but the only sort of useful methods is GetSelection(), which returns the index of the tab. However, if the user splits the view into several tab rows, each row has its own index from zero to INF.
So I get the close events, and know which tab index is being closed, but how can I use this information to know which data controller is being closed? I guess I need to associate some data to the pages I create in the notebook but I don't know how, notebook.AddPage doesn't seem to provide this parameter.
···
--
Grzegorz Adam Hankiewicz, Jefe de producto de TeraVial
Rastertech España S.A. Tel: +34 918 467 390, ext 18.
http://www.rastertech.es/ ghankiewicz@rastertech.es
Hi Gregorz,
I'm playing with wx.aui.notebook and can't find a demo
example which shows how to track which tab is being closed. I
can bind wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE, but the only sort
of useful methods is GetSelection(), which returns the index
of the tab. However, if the user splits the view into several
tab rows, each row has its own index from zero to INF.
Well, you can retrieve the page itself (or the page name) by doing something like:
myPage = self.GetPage(event.GetSelection())
myPageText = self.GetPageText(event.GetSelection())
Or whatever other information you need... Isn't that enough to get the information you need?
Andrea.
···
_________________________________________
Andrea Gavana (gavana@kpo.kz)
Reservoir Engineer
KPDL
4, Millbank
SW1P 3JA London
Direct Tel: +44 (0) 20 717 08936
Mobile Tel: +44 (0) 77 487 70534
Fax: +44 (0) 20 717 08900
Web: http://xoomer.virgilio.it/infinity77
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Hi,
You can set a separate dictionary for page->controller mapping or just
monkey-patch page object injecting reference to it's controller.
Vladimir Ignatov
Gavana, Andrea wrote:
[...] However, if the user splits the view into several tab rows, each row has its own index from zero to INF.
Well, you can retrieve the page itself (or the page name) by doing something like:
myPage = self.GetPage(event.GetSelection())
myPageText = self.GetPageText(event.GetSelection())
Or whatever other information you need... Isn't that enough to get the information you need?
Oh. Since I had printed the result of GetSelection() and found that the indices were the same when the user splits the tab in several rows I thought I actually needed yet another GetTabRow() or something. What you propose works fine even with different rows, so I guess that GetPage internally knows which row of tabs is selected and uses the index on that one.
My confusion, sorry.
···
--
Grzegorz Adam Hankiewicz, Jefe de producto de TeraVial
Rastertech España S.A. Tel: +34 918 467 390, ext 18.
http://www.rastertech.es/ ghankiewicz@rastertech.es
Vladimir Ignatov wrote:
You can set a separate dictionary for page->controller mapping or just
monkey-patch page object injecting reference to it's controller.
Indeed I will have to use both: the latter for convenience, the former to control if the user opens several views of the same data, so I don't delete the data if there are still views pointing to that object. Maybe I could do the multiple view things with reference counting, though...
···
--
Grzegorz Adam Hankiewicz, Jefe de producto de TeraVial
Rastertech España S.A. Tel: +34 918 467 390, ext 18.
http://www.rastertech.es/ ghankiewicz@rastertech.es