ActiveX events in wxPython not working
Jeff Shannon
jeff at ccvcorp.com
Thu Apr 25 15:03:50 EDT 2002
In article <6ddcff55.0204250625.1992ce1b at posting.google.com>,
perry at subdimension.com says...
> Hi,
>
> I'm using wxPython as an ActiveX (GUI) container. The OCX draws a
> gantt
> chart from supplied data. Everything works fine, appart events.
[...]
> class MyGanttPanel(wxPanel):
> def __init__(self, parent):
> wxPanel.__init__(self, parent, -1)
>
> sizer = wxBoxSizer(wxVERTICAL)
If you only have one control, there's no need to use a sizer.
wxPython will, by default, automatically resize a single control
to fill its parent window (in this case the panel). But this has
nothing to do with your problem... :)
>
> GanttClass = MakeActiveXClass(gchart.VcGantt, eventObj=MyEvents)
> gantt.VcGantt = GanttClass(self, -1, wxPoint(0,0),
> style=wxMAXIMIZE)
> gantt.VcGantt.EnableSupplyTextEntryEvent = 1
Okay, you're setting your OCX as an attribute of this gannt
object... but you haven't showed how you're creating or storing
the gantt object itself. If this is something that's local to
the method, then it goes out of scope when __init__() finishes,
and your OCX is destroyed as soon as it starts! (Hmmm...
actually, your sizer may be holding a reference for you, and thus
preventing it from being garbage-collected, but this doesn't seem
like a very safe thing to count on...)
Unfortunately I'm not familiar with the details of ActiveX
containment, so I can't offer any more specific help. You might
do better to ask this question on the wxpython-users mailing list
(http://lists.wxwindows.org/mailman/listinfo/wxpython-users).
--
Jeff Shannon
Technician/Programmer
Credit International
More information about the Python-list
mailing list