[OGL] Event Handler and Composite shapes

Hi,

I’m trying to use a composite shape on a canvas, with special events handling, like gobal selection, double-click for un popup, stuff like that, and I’m trying to derive from EvtHandler.

Is there a reason why the events can’t be handled by a custom handler ? If I use a recangle shape, everything is fine, when I’m using the same handler with a composite shape and some constraints for sub-shapes, no events are processed by the composite shape :frowning:

Matthieu

Here is a “small” sample :
A simple rectangle shape is drawn on the canvas, with a custom event handler, everything works fine, a click prints “test” on the console
A composite shape with a text is drawn, the composite shape has the same custom handler, clicking on the shape does not print “test”

Matthieu

Test.py (3.93 KB)

···

2007/6/25, Matthieu Brucher matthieu.brucher@gmail.com:

Hi,

I’m trying to use a composite shape on a canvas, with special events handling, like gobal selection, double-click for un popup, stuff like that, and I’m trying to derive from EvtHandler.

Is there a reason why the events can’t be handled by a custom handler ? If I use a recangle shape, everything is fine, when I’m using the same handler with a composite shape and some constraints for sub-shapes, no events are processed by the composite shape :frowning:

Matthieu

Hi,

I have never used composite shapes, so I can't be much help. If the rectangle
works well and all you want is a shape with text, then why not use the
rectangles SetText method?

This is a simple composite shape, the real one has an additional icon, a run button, input and output ports, … a rectangle shape is too restricted for that. I thought that CompositeShape was made for that purpose…

But thanks for the answer :wink:

BTW, it is on FC6, wxPython 2.8.4, hand-compiled.

Matthieu

···

2007/6/26, simon kagwe simonkagwe@yahoo.com:

Hi,

I have never used composite shapes, so I can’t be much help. If the rectangle
works well and all you want is a shape with text, then why not use the
rectangles SetText method?

Has someone tried this code ? On Windows, the same happens, and analyzing the CompositeShape code didn’t tell me why this occurs…

Matthieu

···

2007/6/25, Matthieu Brucher < matthieu.brucher@gmail.com>:

Here is a “small” sample :

A simple rectangle shape is drawn on the canvas, with a custom event handler, everything works fine, a click prints “test” on the console
A composite shape with a text is drawn, the composite shape has the same custom handler, clicking on the shape does not print “test”

Matthieu

2007/6/25, Matthieu Brucher <matthieu.brucher@gmail.com

:
Hi,

I’m trying to use a composite shape on a canvas, with special events handling, like gobal selection, double-click for un popup, stuff like that, and I’m trying to derive from EvtHandler.

Is there a reason why the events can’t be handled by a custom handler ? If I use a recangle shape, everything is fine, when I’m using the same handler with a composite shape and some constraints for sub-shapes, no events are processed by the composite shape :frowning:

Matthieu

Some other inquiries :

  • the events can be processed by a shape inside the composite shape.
  • it’s not possible to overload the event methods so as to change the behaviour

That last point is really strange for me. I assumed that overload onRightClick would make my method to be called on a right click, but the original method is still called !

Matthieu

···

2007/6/28, Matthieu Brucher matthieu.brucher@gmail.com:

Has someone tried this code ? On Windows, the same happens, and analyzing the CompositeShape code didn’t tell me why this occurs…

Matthieu

2007/6/25, Matthieu Brucher <
matthieu.brucher@gmail.com>:

Here is a “small” sample :

A simple rectangle shape is drawn on the canvas, with a custom event handler, everything works fine, a click prints “test” on the console
A composite shape with a text is drawn, the composite shape has the same custom handler, clicking on the shape does not print “test”

Matthieu

2007/6/25, Matthieu Brucher <matthieu.brucher@gmail.com

:
Hi,

I’m trying to use a composite shape on a canvas, with special events handling, like gobal selection, double-click for un popup, stuff like that, and I’m trying to derive from EvtHandler.

Is there a reason why the events can’t be handled by a custom handler ? If I use a recangle shape, everything is fine, when I’m using the same handler with a composite shape and some constraints for sub-shapes, no events are processed by the composite shape :frowning:

Matthieu

Matthieu Brucher wrote:

Some other inquiries :
- the events can be processed by a shape inside the composite shape.
- it's not possible to overload the event methods so as to change the behaviour

That last point is really strange for me. I assumed that overload onRightClick would make my method to be called on a right click, but the original method is still called !

All I can suggest is to get a Python debugger and trace through the code so you can see exactly what is going on and figure out why.

···

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

All I can suggest is to get a Python debugger and trace through the code
so you can see exactly what is going on and figure out why.

Thanks for the answer, I hope someone used once Composite Shapes with custom events, but it seems not.

I’m used to debugging, but not GUI debugging in fact, I would already have digged into it if I did. OGL events are dispatched from the canvas ?

Matthieu

Matthieu Brucher wrote:

I'm used to debugging, but not GUI debugging in fact, I would already have digged into it if I did. OGL events are dispatched from the canvas ?

Yep.

···

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

Problem solved, in fact I only set the sensitivity filter of the constraint shape, not the real shapes, so what I do now is desactivating the filter recursively and then activate it for the main shape.

Matthieu

···

2007/6/30, Robin Dunn robin@alldunn.com:

Matthieu Brucher wrote:

I’m used to debugging, but not GUI debugging in fact, I would already
have digged into it if I did. OGL events are dispatched from the canvas ?

Yep.


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