Hi Brian

I appreciate your answer, but i am not quite sure as how to interpret it:

Inserting your code appearently does not solve any of the two problems described.


As leftclicking is allready handled by DragEvent.enableDragEvents(icon1) I would
have to change 'left' in your code to 'right', which should have the same effect
as my onmousedown handler, but actually does not work at all.

Did I miss something ?

Regards
Brian Pedersen


 --- Brian Hayes <[EMAIL PROTECTED]> skrev: > Here is what I did, but there may
be a better way..
> 
>               onclick : function(e) {
>                               if(e.getButton() == 'left'){ //Netscape fix,
> onclick to make sure only the left button
>                                       //Do Something..
>                                       }
>               },
> 
> Brian Hayes
> 
> Hi
> 
> First let me say that I am crazy about the eventmodel in the dynapi,
> attaching
> eventlisteners to a DynLayer instead of making global eventlistener makes
> everything so much easyer.
> 
> I do have one problem, though:
> I have a DHTML applikation resempling a windows desktop with movable icons.
> Rigthclicking these icons should bring up a contextmenu.
> 
> My problem is that rightclicking the icon makes it dragable, which is not my
> intention, only when leftclicking should it become dragable.
> 
> I would also like to ensure that the default browser contextmenu never
> appears,
> this is usually done in a traditional eventlistener by returning false:
> 
> document.onmousedown=function(){ eventListener(event);return false; }
> function eventListener(e){
>       if(event.button==2||event.button==3) {
>               alert('Contextmenu activated');
>       }
>       return false;
> }
> 
> How can I ensure that the layer only becomes dragable when leftclicking and
> how
> can I disable the default browser contextmenu ?
> 
> This is my code:
> <html>
> <head>
> <title>Simple test</title>
> <script language="JavaScript" src="js/dynapi/dynapi.js"></script>
> <script language="Javascript">
>       dynapi.library.setPath('js/dynapi/');
>       dynapi.library.include('dynapi.api');
>       dynapi.library.include('dynapi.api.ext.DragEvent');
>       dynapi.library.include('dynapi.fx.MotionX');
>       dynapi.library.include('FocusManager');
>       dynapi.library.include('BorderManager');
> </script>
> <script language="Javascript">
> 
>       var icon1=new DynLayer(null,25,25,32,32,null,'images/icon1.gif');
>       
>       icon1.setID("icon1");
>       icon1.makeSolid();
>       icon1.setFocus('auto',true,'hover');
>       DragEvent.enableDragEvents(icon1);
>               
>       icon1.addEventListener({
>               onmousedown:function(e){
>                       var o=e.getSource();
>                       if(event.button==2||event.button==3){
>                               alert('Contextmenu activated');
>                       }
>               },
>               onmouseover:function(e){
>                       var o=e.getSource();
>                       o.setInnerBorder(1);
>               },
>               onmouseout:function(e){
>                       var o=e.getSource();
>                       o.setInnerBorder(0);
>               }
>       });
> 
>       dynapi.document.addChild(icon1);
> </script>
> </head>
> <body>
> <script>
>       dynapi.document.insertAllChildren();
> </script>
> </body>
> </html>
> 
> Regards
> Brian Pedersen
> 
> Yahoo! Mail (http://dk.mail.yahoo.com) - Gratis: 6 MB lagerplads, spamfilter
> og virusscan
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dynapi-help
> 
> 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dynapi-help 

Yahoo! Mail (http://dk.mail.yahoo.com) - Gratis: 6 MB lagerplads, spamfilter og 
virusscan


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dynapi-help

Reply via email to