Problem with NOTEBOOK_PAGE_CHANGING event on Windows

Hello everybody,
I'm developing a wxPython application,that is composed by a toolbar, a
listbook and in each listbook page there is a notebook; I test it on
Linux (python 2.5 wxpy 2.8) and Windows XP (python 2.5 wxpy 2.8).

Our matter is that on Linux this works perfectly, but on Windows there
are a lot of problems with the relation between NOTEBOOK_PAGE_CHANGING
and Toolbar.

Infact every time it changes the notebook page we want to show another
toolbar, so there is an association Toolbar/Notebook page.

We have already had some problems on Windows in refreshing the Toolbar
at any notebook page changing and we asked some help in ML with
subject "[wxPython-users] Toolbar anomaly between windows and linux".
Then we solved it, calling every time the realize() method, when we
want to refresh the toolbar.

The event NOTEBOOK_PAGE_CHANGING invokes the
self.MainView.toolbar.ClearTools(), than add the Tools at the toolbar,
and then call the self.MainView.toolbar.Realize() method.

Now the problem is another: the toolbar is rightly refreshed also in
Windows, but there is a issue (only under Win); when the event
EVT_NOTEBOOK_PAGE_CHANGING is called, it switches the toolbar to the
mistaken notebook page and it inverts the toolbar/notebook page
association.

Moreover in a notebook page (a panel) we put a ogl canvas and ,another
time, it works well on Linux, instead in Windows the Canvas does not
fit the all panel size and it appears too small (as a litte
rectangle).

Are known in wxPython "world" some problems between wx toolbar and MS
Windows? Or are known some problems beetween notebook events and
windows?

Thanks all in advance.

···

--
Marco Meoni (Sbaush)

Hi Marco,

Now the problem is another: the toolbar is rightly refreshed also in
Windows, but there is a issue (only under Win); when the event
EVT_NOTEBOOK_PAGE_CHANGING is called, it switches the toolbar to the
mistaken notebook page and it inverts the toolbar/notebook page
association.

Without seeing a line of code, that's a bit hard to guess... but:

1) Have you checked that the EVT_NOTEBOOK_PAGE_CHANGING event handler
is called only *once* when you switch a page?
2) Does this behavior exist if you use other notebooks (i.e.
FlatNotebook, wx.aui.AuiNotebook)?
3) Are you using event.GetSelection()/event.GetOldSelection() in your
EVT_NOTEBOOK_PAGE_CHANGING event handler? If yes, in which way?

Moreover in a notebook page (a panel) we put a ogl canvas and ,another
time, it works well on Linux, instead in Windows the Canvas does not
fit the all panel size and it appears too small (as a litte
rectangle).

This looks like a sizer problem... are you using a sizer to hold your
OGL canvas inside the panel? If the answer is no, you should. If the
answer is yes, you should probably try to reproduce the problem in a
small and runnable app you can post here. BTW, if you are using a
sizer, have you tried calling Layout() when you switch the notebook
page (even if this should *not* be required)?

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

···

On 5/4/07, Marco Meoni - Sbaush wrote:

I think I found the bug: It is a issue of wxPython notebook (I think) in Windows.
Is this: Suppose to have a notebook with a event EVT_NOTEBOOK_PAGE_CHANGING registered; in windows when I click from the tab 0 to tab 1 I got by the event.GetOldSelection , event.GetSelection and notebook.GetSelection respective old = 0 new=0 sel = 0.
Instead in Linux I correctly get old = 0, new= 1 sel = 0.

I noticed it comparing the wxDemos apps with the notebook module on both Win ‘n’ Linux.

I also noticed that in Windows each event, it catches and printed two times.
Not egual to linux one.

Let me Know,
if I’m right or wrong

King Regards

···

On 5/4/07, Andrea Gavana andrea.gavana@gmail.com wrote:

Hi Marco,

On 5/4/07, Marco Meoni - Sbaush wrote:

Now the problem is another: the toolbar is rightly refreshed also in
Windows, but there is a issue (only under Win); when the event
EVT_NOTEBOOK_PAGE_CHANGING is called, it switches the toolbar to the

mistaken notebook page and it inverts the toolbar/notebook page
association.

Without seeing a line of code, that’s a bit hard to guess… but:

  1. Have you checked that the EVT_NOTEBOOK_PAGE_CHANGING event handler

is called only once when you switch a page?
2) Does this behavior exist if you use other notebooks (i.e.
FlatNotebook, wx.aui.AuiNotebook)?
3) Are you using event.GetSelection()/event.GetOldSelection() in your

EVT_NOTEBOOK_PAGE_CHANGING event handler? If yes, in which way?

Moreover in a notebook page (a panel) we put a ogl canvas and ,another
time, it works well on Linux, instead in Windows the Canvas does not

fit the all panel size and it appears too small (as a litte
rectangle).

This looks like a sizer problem… are you using a sizer to hold your
OGL canvas inside the panel? If the answer is no, you should. If the

answer is yes, you should probably try to reproduce the problem in a
small and runnable app you can post here. BTW, if you are using a
sizer, have you tried calling Layout() when you switch the notebook
page (even if this should not be required)?

Andrea.

“Imagination Is The Only Weapon In The War Against Reality.”
http://xoomer.virgilio.it/infinity77/


To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org


Iacopo Masi

Iacopo Masi wrote:

I think I found the bug: It is a issue of wxPython notebook (I think) in Windows.
Is this: Suppose to have a notebook with a event EVT_NOTEBOOK_PAGE_CHANGING registered; in windows when I click from the tab 0 to tab 1 I got by the event.GetOldSelection , event.GetSelection and notebook.GetSelection respective old = 0 new=0 sel = 0.
Instead in Linux I correctly get old = 0, new= 1 sel = 0.

I noticed it comparing the wxDemos apps with the notebook module on both Win 'n' Linux.
I also noticed that in Windows each event, it catches and printed two times.
Not egual to linux one.

Let me Know,
if I'm right or wrong

Yes I think it's a bug, but it's been discussed before on wx-dev and still not fixed. There may have been some disagreement about which is the proper semantics.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!