Events with wxPython

Hi!

  I'm developing an application using wxPython. I've two classes in two
different files. I'll call them class A (a wxFrame) and class B (a
wxPanel with a wxTreeCtrl inside). Class B is instanced in a property of
class A. I want one event of class B (EVENT_TREE_ITEM_ACTIVATED) modify
other property of class A. This event is captured in class B so I don't
know how manage it from class A.

  When I was a Delphi programmer (time ago, time ago!! :D) I defined
event in class B and then, in class A, I do something like this:

self.instanceClassB.onEvent := self.onClassBEvent

and then, with the method onClassBEvent I can do whatever I want.

  How can I do something like this in wxPython?

  Thank you a lot.

···

--
Sergio Sánchez Ramírez <sergio@corecanarias.com>
Core Be Digital S.L.

There are a couple of ways to do this...
1) You should be able to just use the EVENT_TREE_ITEM_ACTIVATED macro in
class A and as long as you use the right id number for the wxTreeCtrl.
  i.e. EVENT_TREE_ITEM_ACTIVATED(self, tree_id, self.onClassEvent)
2) an alternative to this is using the macro in class B and having it
directly call the class A function.
  i.e. EVENT_TREE_ITEM_ACTIVATED(self, tree_id,
self.parent.onClassEvent)
3) If my understanding is correct I believe that if you use my first
suggestion and use the macro normally (i.e. in class B pointing to a
class B function) and add event.skip() to the end of the class B
function it should go "up the chain of command" and hit the event
handler of class A.

Good luck,
Sam
  I'm developing an application using wxPython. I've two classes
in two different files. I'll call them class A (a wxFrame) and class B
(a wxPanel with a wxTreeCtrl inside). Class B is instanced in a property
of class A. I want one event of class B (EVENT_TREE_ITEM_ACTIVATED)
modify other property of class A. This event is captured in class B so I
don't know how manage it from class A.

  When I was a Delphi programmer (time ago, time ago!! :D) I
defined event in class B and then, in class A, I do something like this:

self.instanceClassB.onEvent := self.onClassBEvent

and then, with the method onClassBEvent I can do whatever I want.

  How can I do something like this in wxPython?

  Thank you a lot.

···

--
Sergio Sánchez Ramírez <sergio@corecanarias.com>
Core Be Digital S.L.

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