Thanks, but it doesn't help. 
This example is for changing the right click menu (the function 
setMenu is called on this onload event of the svg tag) : you create a 
new menu and you replace the default one.

I want to add other items dynamically.
For example, I replace the default rigth click menu by 

Menu1
Menu2 >
       Menu2.1
       Menu2.2
Menu3
Menu4

This menu is create ilke in your example and load on the onload event 
of the svg tag.

I want now to add a Menu2.3 below Menu2.2

I don't know how many menu items I'll have to add, so I cannot create 
them and hide/show them according to what I need to show.

Thanks,

jérôme



--- In svg-developers@yahoogroups.com, "tamsvg" <[EMAIL PROTECTED]> 
wrote:
> --- In svg-developers@yahoogroups.com, "jololivier"
> <[EMAIL PROTECTED]> wrote:
> > hello,
> > 
> > is that possible to add dynamically menu items to the right click 
menu?
> > Thanks a lot,
> > jollt
> 
> 
> Hi Jerome,
> 
> I found an example for changing the context menu, but it only works
> with Adobe SVG Viewer. Hope it helps:
> 
> <?xml version="1.0" standalone="no"?>
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
> "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"; [
>    <!ATTLIST svg xmlns:xlink CDATA 
#FIXED "http://www.w3.org/1999/xlink";>
>    <!-- experimentelle DTD-Erweiterung by TM 2003 -->
>    <!ENTITY % defsExt "|menu">
>    <!ELEMENT menu (header,(item|menu|separator)*)>
>    <!ELEMENT header (#PCDATA)>
>    <!ELEMENT item (#PCDATA)>
>    <!ELEMENT separator EMPTY>
>    <!ATTLIST menu id ID #IMPLIED>
>    <!ATTLIST item action CDATA #IMPLIED checked CDATA #IMPLIED
> onactivate CDATA #IMPLIED>
>  ]>
>  
>  <!-- SVG - Learning By Coding - 
http://www.datenverdrahten.de/svglbc/ -->
>  <!--    Author: Dr. Thomas Meinike 05/03 - [EMAIL PROTECTED]     -->
>  
>  <svg xmlns="http://www.w3.org/2000/svg";
> xmlns:xlink="http://www.w3.org/1999/xlink";
>    onload="setMenu('TMenuE')">
>  
>  
>    <defs>
>  
>      <script type="text/javascript">
>        <![CDATA[
>  
>          function setMenu(menuid)
>          {
>            var ver=getSVGViewerVersion();
>            if(ver.indexOf("Adobe")!=-1)
>            {
>              var
> newMenu=parseXML(printNode(getDocument().getElementById
(menuid)),getContextMenu());
>              if(ver.indexOf("6.0")!=-1)
>              {
>               
> getContextMenu().replaceChild(newMenu.firstChild,getContextMenu
().firstChild);
>              }
>              else
>              {
>               
> getContextMenu().replaceChild(newMenu,getContextMenu().firstChild);
>              }          
>            }
>          }
>  
>          function AboutInfo()
>          {
>            alert("SVG - Learning By Coding\n\n(C) 2002...2003\nby 
Dr.
> Thomas Meinike");
>          }
>  
>        ]]>
>      </script>
>  
>      <!-- This is the menu -->
>      <menu id="TMenuE">
>  
>        <header>Adobe SVG Viewer</header>
>  
>        <item action="Open">&amp;Open</item>
>        <item action="OpenNew">Open in &amp;New Window</item>
>  
>        <separator/>
>  
>        <item action="ZoomIn">Zoom &amp;In</item>
>        <item action="ZoomOut">Zoom &amp;Out</item>
>        <item action="OriginalView">&amp;Original View</item>
>  
>        <separator/>
>  
>        <item action="Quality">Higher &amp;Quality</item>
>        <item action="Pause">&amp;Pause</item>
>        <item action="Mute">&amp;Mute</item>
>  
>        <separator/>
>  
>        <item action="Find">&amp;Find...</item>
>        <item action="FindAgain">Find &amp;Again</item>
>  
>        <separator/>
>  
>        <item action="Copy">Copy Selected &amp;Text</item>
>        <item action="CopySVG">&amp;Copy SVG</item>
>        <item action="ViewSVG">&amp;View SVG</item>
>        <item action="ViewSource">View Sourc&amp;e</item>
>        <item action="SaveAs">&amp;Save SVG As...</item>
>  
>        <separator/>
>  
>        <item action="Help">&amp;Help</item>
>        <item action="About">&amp;About Adobe SVG Viewer...</item>
>  
>        <separator/>
>        
>        <menu>
>            <header>My Menu</header>
>              <item onactivate="alert('menu 1\nwas called')">Menu 
1</item>
>              <item checked="yes" onactivate="alert('menu 2\nwas
> called')">Menu 2</item>
>              <item onactivate="alert('menu 3\nwas called')">Menu 
3</item>
>           </menu>
>         
>        <seperator/>
>  
>        <item onactivate="AboutInfo(evt)">About 
S&amp;VGLBC...</item> 
>  
>      </menu>
>  
>    </defs>
>  
>   <text x="20" y="30" style="fill: #000; font-size: 24px">
>      Change context menu in Adobe SVG Viewer</text>
>  
>  </svg>
> 
> tam





-----
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/
 



Reply via email to