Thanks J�r�me
that's a good idea. I will try this.
Olaf
J�r�me Tricand de la Goutte wrote:
> Hi Olaf
>
> I did something quite similar:
> by construction, I set onclick event to any object. For a text box, it could be
>
> <g id="textBox1"
> onclick='click("textBox","textBox1",evt);set_TextBox_Text(evt,"You've clicked on
> me")'>
> <rect x="..." .../>
> <text x="..." ...>My init content</text>
> </g>
>
> function click(myType, myName, evt)
> {
> //according to the type of the last object I've clicked on, I call a specific
> function to simulate a
> //onLostFocus event
> switch (myTypeOld)
> {
> case "textBox":
> textBoxOnLostFocus(myNameOld)
> ...
> }
>
> // I memorize the name and the time of object on which I've clicked for the next
> onLostFocus event
> myTypeOld=myType
> myNameOld=myName
>
> //according to the new type of object, I call a specific function to simulate the
> onFocus event on a object
> switch (myTypeOld)
> {
> case "textBox":
> textBoxOnFocus(myNameOld)
> ...
> }
>
> function textBoxOnLostFocus(myName)
> {
> // the textBox loose the focus
> document.getElementById(myName).firstChild.setAttribute('fill','red')
> }
>
> function textBoxOnFocus(myName)
> {
> // the textBox get the focus
> document.getElementById(myName).firstChild.setAttribute('fill','blue')
> }
>
>
> function set_TextBox_Text(evt,myText)
> {
> evt.childNodes.item(1).firstChild.data=myText
> }
>
>
> I've supposed that a textBox with the focus is blue and is red
> otherwise, but you can do whatever you want
> You can also change the two swicth by something like
> eval(myTypeold+"onLostFocus(myName)")
> That way, you can have many different types of objects with similar
> interfaces
>
> Hope it helps
>
> J�r�me
--
Olaf Schnabel
Department of Cartography
Swiss Federal Institute of Technology (ETH)
ETH Hoenggerberg, CH-8093 Zurich, Switzerland
phone: ++41-44-633 3031
e-mail: [EMAIL PROTECTED]
www: http://www.karto.ethz.ch/schnabel
------------------------ Yahoo! Groups Sponsor --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/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/