2 events generated instead of only 1 with wxTreeCrl

Hi,

maybe I wrote my mail too quickly, so that the description of my problem
is not so easy to understand as I wish. So here is a little more explanation:

My TreeCtrl has a method

def self.OnTreeSelectionChange

which is the callback on the event

wx.EVT_TREE_SEL_CHANGED(self, -1, self.OnTreeSelectionChange)

ie it gets called when I click on an item, or when somewhere in the code
I call the tree-control method tree.SelectItem(). Actually this method only prints

“OnTreeSelectionChange”, event.GetId()

This TreeCtrl has also a!
method

self.OnTreeRightClick as callback for
wx.EVT_TREE_ITEM_RIGHT_CLICK(self, -1, self.OnTreeRightClick)

which has the effect to build and popup a menu.

The callback of this menu is the method “OnTreePopupNew” which append an item to the tree
and set the tree selection on this new item through a call to tree.SelectItem(newItem,1):

code

    print "OnTreePopupNew S"
    self.tree.SelectItem(newItem,1)
    print "OnTreePopupNew E"

So I am expecting on stdout the message :

OnTreePopupNew S
OnTreeSelectionChange
OnTreePopupNew E

but what I get is

OnTreePopupNew S
OnTreeSelectionChange
OnTreeSelectionChange ( !
–> why this one ?? )
OnTreePopupNew E

Why do I get “OnTre
eSelectionChange” twice on windows ( not on linux) ??
I would like to avoid this without having to write something like

if ( self.currItem != item ):
self.currItem = item
print “OnTreeSelectionChange”

Thank in advance,

xm

SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192

XAVJLM@web.de wrote:

but what I get is

OnTreePopupNew S
OnTreeSelectionChange
OnTreeSelectionChange ( ! --> why this one ?? )

Probably because of the call to Skip in that handler. You're telling the system that you haven't handled the event and so it is resulting in sending it again through a different path, or perhaps a different native event that wx is treating as the same.

···

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

I have been unsuccessful in importing hte "csv" module. It is in the list of Python 2.4 modules, and other modules import fine. I tried reinstalling Python 2.4, but that didn't help.

I am on a Windows XP, Home Edition, Version 2002, Service Pack 2, system.

Any ideas?

Randy

---------------- from yCrust -----------------------------------------------
PyCrust 0.9.5 - The Flakiest Python Shell
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import csv
Traceback (most recent call last):
  File "<input>", line 1, in ?
ImportError: DLL load failed: The specified module could not be found.

···

--------------------------------------------------------------------------------

Randy Raymond wrote:

I have been unsuccessful in importing hte "csv" module. It is in the list of Python 2.4 modules, and other modules import fine. I tried reinstalling Python 2.4, but that didn't help.

I am on a Windows XP, Home Edition, Version 2002, Service Pack 2, system.

Any ideas?

First, you should ask this on one of the Python lists as it has nothing to do with wxPython.

Randy

---------------- from yCrust -----------------------------------------------
PyCrust 0.9.5 - The Flakiest Python Shell
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import csv
Traceback (most recent call last):
File "<input>", line 1, in ?
ImportError: DLL load failed: The specified module could not be found.

Second, look for some other file named csv.* on the sys.path that Python may be finding by accident. The Python csv module is pure python and so it should not need to load any DLLs.

···

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

First, sorry, for the post.

Second, your suggestion fixed the issue!

Randy

···

----- Original Message ----- From: "Robin Dunn" <robin@alldunn.com>
To: <wxPython-users@lists.wxwidgets.org>
Sent: Sunday, May 14, 2006 3:05 PM
Subject: Re: [wxPython-users] 2 events generated instead of only 1 with wxTreeCrl

Randy Raymond wrote:

I have been unsuccessful in importing hte "csv" module. It is in the list of Python 2.4 modules, and other modules import fine. I tried reinstalling Python 2.4, but that didn't help.

I am on a Windows XP, Home Edition, Version 2002, Service Pack 2, system.

Any ideas?

First, you should ask this on one of the Python lists as it has nothing to do with wxPython.

Randy

---------------- from Crust -----------------------------------------------
PyCrust 0.9.5 - The Flakiest Python Shell
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import csv
Traceback (most recent call last):
File "<input>", line 1, in ?
ImportError: DLL load failed: The specified module could not be found.

Second, look for some other file named csv.* on the sys.path that Python may be finding by accident. The Python csv module is pure python and so it should not need to load any DLLs.

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

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