raf
2014-10-08 04:33:39 UTC
Hi,
windows-8.1, python-2.7.8, wxpython-2.8.12.1
I have an application with a large dynamic popup menu.
Every time I construct it, I use ID_ANY as the id
for all the menu items.
After calling frame.PopupMenu(menu), I call menu.Delete()
but all of the ids used in the menu remain effectively
claimed and the next time the menu is constructed,
the ids used by the new menu items are higher than the
last time.
I assume that's ok because http://wiki.wxpython.org/Getting%20Started
says "You can make your own IDs, but there is no reason to do that."
However, occasionally I get reports from the users that when they
select a menu item, the application behaves as though some other
completely unrelated menu item had been selected.
I added some logging to see what was going on and asked them to
tell me when it next happened which it just has. It seems that the
problem happened the first time the user selected an item
after the menu item ids has exceeded 2**16. This might be an
unimportant coincidence. I only have one data point. But it
might be relevant.
When the problem occurs, the id of the selected menu item is a
much lower number than the ids of any of the menu items that
exist in the menu at the time. It looks as though it's using
a much earlier id from a previous incarnation of the menu.
Does anyone have any idea what might be going wrong?
If it could have something to do with the ever increasing ids,
is there a way to tell wx to reset its next-available-id to
be one more than the currently used id?
Would using application-defined ids be ok or might other uses
of ID_ANY reuse ids that I've chosen?
Cheers,
raf
windows-8.1, python-2.7.8, wxpython-2.8.12.1
I have an application with a large dynamic popup menu.
Every time I construct it, I use ID_ANY as the id
for all the menu items.
After calling frame.PopupMenu(menu), I call menu.Delete()
but all of the ids used in the menu remain effectively
claimed and the next time the menu is constructed,
the ids used by the new menu items are higher than the
last time.
I assume that's ok because http://wiki.wxpython.org/Getting%20Started
says "You can make your own IDs, but there is no reason to do that."
However, occasionally I get reports from the users that when they
select a menu item, the application behaves as though some other
completely unrelated menu item had been selected.
I added some logging to see what was going on and asked them to
tell me when it next happened which it just has. It seems that the
problem happened the first time the user selected an item
after the menu item ids has exceeded 2**16. This might be an
unimportant coincidence. I only have one data point. But it
might be relevant.
When the problem occurs, the id of the selected menu item is a
much lower number than the ids of any of the menu items that
exist in the menu at the time. It looks as though it's using
a much earlier id from a previous incarnation of the menu.
Does anyone have any idea what might be going wrong?
If it could have something to do with the ever increasing ids,
is there a way to tell wx to reset its next-available-id to
be one more than the currently used id?
Would using application-defined ids be ok or might other uses
of ID_ANY reuse ids that I've chosen?
Cheers,
raf
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.