Hi, In your onload function call focus(); at the end. Mit freundlichen Gr��en/Regards Chris Peto Freelance System Development, Resource Solutions Founding Partner, Vectoreal ------------------------------------- Germany Mobile: +49 (0) 173 308 7843 Tel:+49(0) 6103 80 21 98 http://www.resource-solutions.de <http://www.resource-solutions.de/> http://www.vectoreal.com <http://www.vectoreal.com/> SVG editor: http://www.resource-solutions.de/svgeditor.html mailto:[EMAIL PROTECTED] ------------------------------------ Member of: SPARK - SVG Programmers' Application Resource Kit SVG site: http://www.schemasoft.org/svg/main.svg HTML site: http://www.schemasoft.org/
-----Original Message----- From: bg_ie [mailto:[EMAIL PROTECTED] Sent: Dienstag, 22. M�rz 2005 20:48 To: [email protected] Subject: [svg-developers] Re: Directing focus to the SVG view on document load Put another way, "on load" for my document results in the execution of the following code - svgDocument = evt.target.ownerDocument; svgDocument.documentElement.addEventListener("keypress",KeyPressFunct,fa lse); My problem is that I need to click within my bowser's viewport in order for "svgDocument" to gain focus. Before I do this, key strokes are ignored, after this key strokes are handled by KeyPressFunct. Can any one please tell me how I can force focus to "svgDocument" so that KeyPressFunct reacts to key strokes once my document has loaded, and not until I have clicked on the screen. If I'm not being clear, let me know and I'll try and explain a little clearer. Thanks for your help, Barry. --- In [email protected], "bg_ie" <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm trying to capture keyboard events for an svg document. The problem > I'm having though is that when I display this document in my browser > (firefox) I have to click on the svg document's view in order to give > it focus, in turn allowing its event handler to react to keyboard > events. I therefore tried - > > window.addEventListener("keypress",KPress,false); > > instead of > > (evt.target.ownerDocument).documentElement.addEventListener("keypress",K Press,false); > > but the former is not defined. I'm using AVG6. > > Anyway, I was wondering if it is possible to direct focus to the SVG > document on loading the document? This will allow it to react straigh > away to events. Another problem I notice is that if I minimise the > browser window, click in another, and maximise my origional browser > window, I have to again click within the view to restore focus to the > svg. > > I was thinking a solution would be to create a large rectangle for the > entire svg view, and assign it a mousemove event handler. Any better > solutions? > > Cheers, > > Barry. > > <?xml version="1.0" standalone="no"?> > <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" > "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> > <svg onload="svgOnLoad(evt)" a3:scriptImplementation="Adobe" > xmlns:a3="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" > xmlns:xlink="http://www.w3.org/1999/xlink" > xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" > zoomAndPan="magnify"> > <script type="text/ecmascript" a3:scriptImplementation="Adobe"> > <![CDATA[ > > function svgOnLoad(evt) > { > if ( window.svgDocument == null ) > svgDocument = evt.target.ownerDocument; > > //svgDocument.documentElement.addEventListener("keypress",KPress,false); > window.addEventListener("keypress",KPress,false); > } > > ]]></script> > </svg> ----- To unsubscribe send a message to: [EMAIL PROTECTED] -or- visit http://groups.yahoo.com/group/svg-developers and click "edit my membership" ---- Yahoo! Groups Sponsor ADVERTISEMENT <http://us.ard.yahoo.com/SIG=12941rr9k/M=298184.6191685.7192823.3001176/ D=groups/S=1706030389:HM/EXP=1111607357/A=2593423/R=0/SIG=11el9gslf/*htt p://www.netflix.com/Default?mqso=60190075> click here <http://us.adserver.yahoo.com/l?M=298184.6191685.7192823.3001176/D=group s/S=:HM/A=2593423/rand=358221759> _____ 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] <mailto:[EMAIL PROTECTED]> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service <http://docs.yahoo.com/info/terms/> . [Non-text portions of this message have been removed] ----- 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/

