Hi, I used: ((Element)event.getTarget()).setAttribute("fill", "yellow");
wz On Thu, 2003-11-13 at 17:16, Ron King wrote: > Thanks Thomas! I see events now! However, my svg files consist of many path > elements, and > the type returned by the event is a SVGOMSVGElement. For a painting > function, I need to be able to change the fill attribute of a path. How can > I get the path element by clicking inside of the area enclosed by the path? > > Thanks, Ron > > ----- Original Message ----- > From: "Thomas DeWeese" <[EMAIL PROTECTED]> > To: "Batik Users" <[EMAIL PROTECTED]> > Sent: Thursday, November 13, 2003 4:45 AM > Subject: Re: trouble adding eventlistener to Squiggle > > > > Ron King wrote: > > > > > > > > Hi All, > > > > > > I've looked for an example of handling events, but I still can't figure > > > it out! I made the method below > > > to add a listener for _EACH_ path in an svg file (I'm doing this in > > > Batik Squiggle, after a document is loaded): > > > > You probably need to tell squiggle to load your document as > > a dynamic document: canvas.setDocumentState(JSVGCanvs.ALWAYS_DYNAMIC) > > Normally if Batik doesn't see event attributes or script elements > > it assumes it is a static document. This must be done before the > > document is loaded. > > > > Additionally you may want to look into: > > getElementsByTagNameNS to get the path elements. > > You should probably check for SVGPathElement not SVGOMPathElement > > (our internal implementation), finally you already have the element > > why are you looking it up by 'id'? Just cast it to an EventTarget. > > > > > > > EventTarget t = (EventTarget) > > > (e.getSVGDocument().getElementById(pathId)); > > > t.addEventListener("click", onClick, true); > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]