Francis,

Yes, you could do this. The current version doesn't have the context menu
enabled, but it won't take much to do. We're about to do a new build so I'll
ensure this is in for that.

In terms of the architecture, it would work slightly differently to the way
you have it. First, your XHTML document would register for the
'context-menu' event. When you receive it you invoke a message with an
XForms select1 control in it. Since an xf:select1 can be driven by instance
data (which is just a DOM), then you simply ensure that the instance data
reflects the state that you want, and the menu choices will change. In other
words, instead of calling rewriteContextMenu() to change the menu
specifically, you would change some instance data to reflect tasks that have
been performed, or some status (an item cannot be deleted, for
example)--this data then just happens to be used to drive the menu, but it
would also drive other parts of the form.

Note that the menu could also contain mark-up, and so be made to look
different to the usual menus. If you have loaded formsPlayer 1.x you may
have seen the RSS Reader. When you add a new RSS feed it pops up a system
tray message to confirm that you have added something. This message uses the
XForms message element with mark-up in and this mark-up is passed to another
instance of the viewer that slides in and out by the system tray. Since it
is a viewer, this means that you can have SVG system tray messages, and the
same principle will apply to the context menu.

I'll try to knock up a demo to go with the next release to show how it could
be done.

Regards,

Mark


Mark Birbeck
CEO
x-port.net Ltd.

e: [EMAIL PROTECTED]
t: +44 (0) 20 7689 9232
w: http://www.formsPlayer.com/
b: http://internet-apps.blogspot.com/

Download our XForms processor from
http://www.formsPlayer.com/ 

> -----Original Message-----
> From: [email protected] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Francis Hemsher
> Sent: 09 June 2005 21:35
> To: [email protected]
> Subject: [svg-developers] Re: SVG and HTML all in one html file
> 
> Hopefully, my questions will only confirm the quality of your work.
> Yes, right-mouse click is important in the current use of 
> ASV3, and its pop-up context menu.
> 
> Below are two files that demonstrate the dynamic needs for 
> the context menu:
> 
> If can accomplish dynamic changes the 'pop-up' menu, then I 
> will be happy as a clam.
> 
> Francis
> 
> the HTML file:
> <HTML>
> <HEAD>
> <style>
> body{
> font-family:arial;
> font-size:14;
> }
> </style>
> <TITLE>Dynamic Context Menu</TITLE>
> </HEAD>
> <BODY onLoad=init()>
> 
> <embed  name="svgEmbed"  src="dynamicContext.svg" 
> style="width:500;height:500" type="image/svg+xml"> 
> <h2>Dynamically writing the Context Menu for the Adobe SVG 
> Viewer, version 3</h2> The reason this is needed, is to 
> provide the user with an intelligent 'pop-up' menu that 
> displays only the functions that are needed during a specific 
> operation on the SVG drawing. This simplifies their choices, 
> and also simplifies the coding, whereby many, many status 
> flags are eliminated.<p>
> 
> The pop-up menu also has certain 'rhythm':<br> 1. Select an 
> operation.<br> 2. Do the selected operation.<br> 3. Finish or 
> Cancel the operation.<br> 4. Return to previous selection choices.<p>
> 
> This feature on the MobiusPortal DataPort & ViewPort are of vital
> importance: The user's
> experience must be seamless and intuitive. The trick is to 
> get them to initially right-click their mouse button over the 
> SVG drawing, and begin boogeying to the rhythm:)<p>
>  
> <script>
> var docSVG
> var ContextMenu
> function init()
> {
>       docSVG=document.embeds['svgEmbed'].getSVGDocument()
>       ContextMenu=docSVG.getElementById("ContextMenu")
>       //---initial context menu---
>       rewriteContextMenu(",0,")
> }
> 
> //--------build context menus for SVG--- //---calls function 
> in SVG that use Adobe Viewer, resident methods--- function 
> makeContextMenu(){window.makeContextMenu();}
> 
> 
> //---An array of all functions and their displayed text---- 
> var contextMenuArray= new Array()
> 
> contextMenuArray[0]="doThis(),Do This Please!"
> contextMenuArray[1]="finish(),finish it dammit!"
> contextMenuArray[2]="cancel(),cancel it I dare you"
> 
> //---fired at every function to update user's pop-up 
> choices--- function rewriteContextMenu(items) {
>               //---purge previous items---
>               menuChildren=ContextMenu.childNodes
>               for(i=menuChildren.length-1;i>=0;i--)
>               {
>                       ContextMenu.removeChild(menuChildren.item(i))
>               }
>               
>               //---then for some unknown reason:)---
>               //---start with a bogus, empty item??---
>                               createItem=docSVG.createElement
> ("item")
>                               textNode=docSVG.createTextNode("")
>                               createItem.appendChild(textNode)
>                               ContextMenu.appendChild(createItem)
>                               
>               //---A title for this menu----
>                               createItem=docSVG.createElement
> ("item")
>                               textNode=docSVG.createTextNode
> ("MOBIUS PORTAL IS THE GREATEST!")
>                               createItem.appendChild(textNode)
>                               ContextMenu.appendChild(createItem)
>                               
>                               separator=docSVG.createElement
> ("separator")
>                               ContextMenu.appendChild(separator)
>                               
>       for(i=0;i<contextMenuArray.length;i++)
>       {
>               addMe=","+i+","
>               if(items.indexOf(addMe)!=-1)
>               {
>                       menuItem=contextMenuArray[i]
>                       split=menuItem.split(",")
>                       activate=split[0]
>                       textItem=split[1]
>                       
>                               createItem=docSVG.createElement
> ("item")
>                               createItem.setAttribute
> ("onactivate",activate)
>                               textNode=docSVG.createTextNode
> (textItem)
>                               createItem.appendChild(textNode)
>                               ContextMenu.appendChild(createItem)
>               }       
>       }
>       
>       separator=docSVG.createElement("separator")
>       ContextMenu.appendChild(separator)
>       
>       //---include the Adobe resident original view selection---
>                               view=docSVG.createElement("item")
>                               view.setAttribute
> ("action","OriginalView")
>                               textNode=docSVG.createTextNode("Full
> View")
>                               view.appendChild(textNode)
>                               ContextMenu.appendChild(view)
>       
>       makeContextMenu()
> 
> }
> 
> 
> //---functions resident at the context menu array---
> 
> function doThis()
> {
>       rewriteContextMenu(",1,2,")
> }
> 
> function finish()
> {
>       rewriteContextMenu(",0,")
> }
> 
> function cancel()
> {
>       rewriteContextMenu(",0,")
> }
> 
> 
> 
> </script>
> 
> </BODY>
> </HTML>
> 
> dynamicContext.svg
> <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE svg 
> PUBLIC "-//W3C//DTD SVG 1.0//EN" 
> "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"; >
> <svg id="mySVG"   width="500" height="500">
> <rect x="0" y="0"  width="100%"  height="100%" fill="lemonchiffon" />
> 
> <defs  id="menuDefs">
>       <menu  id='ContextMenu' 
> xmlns="http://www.mobiusPortal.com"; />
> </defs>
> <script>
>               <![CDATA[
>                               //---allows function to be called
> from HTML---
>               parent.makeContextMenu=makeContextMenu
>               function makeContextMenu(){var newMenuRoot = 
> parseXML ( printNode( document.getElementById( "ContextMenu" 
> ) ), contextMenu );contextMenu.replaceChild( newMenuRoot, 
> contextMenu.firstChild )} ;
>               ]]>
>       </script>
> 
> </svg>
> 
> 
> 
> 
> 
> --- In [email protected], "Mark Birbeck" 
> <[EMAIL PROTECTED]> wrote:
> > Francis,
> > 
> > > If you can get your viewer seamless with IE and have nice CSS 
> > > capablities then I may know of a site that could use it:) Anyway, 
> > > I'll download it and fiddle with it for a while.
> > > Expect a few questions from yours truly about it's abilities to 
> > > create a dynamic context menu.
> > 
> > I'd be very pleased to get questions! I look forward to your
> comments.
> > 
> > BTW, by context menu, do you mean with a right-hand mouse click?
> > 
> > Regards,
> > 
> > Mark
> > 
> > 
> > Mark Birbeck
> > CEO
> > x-port.net Ltd.
> > 
> > e: [EMAIL PROTECTED]
> > t: +44 (0) 20 7689 9232
> > w: http://www.formsPlayer.com/
> > b: http://internet-apps.blogspot.com/
> > 
> > Download our XForms processor from
> > http://www.formsPlayer.com/
> 
> 
> 
> 
> -----
> 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 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