Hello all,
I'm trying to write a C# application which has an ActiveX SVG viewer
in it. I'm suffering a problem where a TargetInvocationException is
thrown when I attempt to bind an event to an element on the SVG. The
inner exception is that it's a TypeMismatch thrown by the object I'm
trying to bind to.
The specific line is:
element.GetType().InvokeMember("addEventListener",
BindingFlags.InvokeMethod, null, element, eventParam);
element is a COM object representation of the element I want to bind
to, and has been verified as the right one.
eventParam is a three element Object array, the zeroth element
contains the string name of the event (in this case, "mousedown"), the
first element contains the window I want to listen for the event, in
this case "this", and the last one is the boolean telling it whether
or not to bubble the event. ("False" in this case.)
Here's what else is going on:
My window is an ordinary class derived from a System.Windows.Forms.Form.
It's one of several windows inside an MDI container.
When I pass it "this.Parent", which is a
System.Windows.Forms.MDIClient, then it passes on through without
throwing the exception.
When I pass it any control, such as a Button or a ListBox, or even an
undifferentiated Form, it passes on through without throwing the
exception. The problem with that of course that I can't use the
HandleEvent(Object evt) delegate to hear the events.
Passing it "this.Parent.Parent", which is the overall MDI container
doesn't work either. It throws the same exception.
I have a prototype project where this works just fine. "this" is
accepted and there's no problem. The event listener delegate fires
and I can play with the SVG DOM programatically. However, the
prototype is a one form application, not part of a larger MDI
application.
Aside from that, I can't find much difference between the two. Both
delegate method headers are "public void handleEvent(object evt)" Both
classes are public within the application. The MDI one has been split
by Visual Studio into the two partial classes, one for the code, and
one for the design elements. The prototype project has it all on one
form.
I read something elsewhere which stated that things bound to the SVG
elements needed to implement the IEventListener interface. However I
found virtually no references to that or what needs to be implemented
within the C# side of things.
That's all I can think of right now. Thank you for your time.
------------------------ Yahoo! Groups Sponsor --------------------~-->
Something is new at Yahoo! Groups. Check out the enhanced email design.
http://us.click.yahoo.com/TktRrD/gOaOAA/yQLSAA/1U_rlB/TM
--------------------------------------------------------------------~->
-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my
membership"
----
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/