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
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”
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
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…
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?
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”
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
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 !
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”
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
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!
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.