From: <bas...@ya...> - 2003-09-30 07:02:33
|
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 |
From: Brian H. <bg...@ke...> - 2003-09-30 09:52:39
|
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 Dyn...@li... https://lists.sourceforge.net/lists/listinfo/dynapi-help |
From: Doug M. <do...@cr...> - 2003-09-30 17:23:48
|
the following _should_ work but does not under IE 6. lyr.addEventListener({ ondragstart:function(e){ status=e.getButton(); if(e.getButton() == "right"){ e.cancelDrag(); } } }); when in the ondragstart event, in the mouse_ie.js:MouseEvent.getButton() returns left always. Through debugging I noteied the the error condition on line: 26 "if (!this._mouseEvent) return "ouch";" (I added the "ouch") always returns "ouch" Works normally inside of a onclick event. (returns left, middle or right) Same deal in NS 4x, works correctly in onclick event, but executes error code in ondragstart event at: line 26 in mouse_ns4.js:getButton() "if (!this._browserEvent) return "ouch";" (i added the ouch) Mozilla 1.x: Same deal again.. It seems obvious to me that this is a bug in the common base of the dragevents scheme.. I am at work right now, and have no intoernet at home. Someone else will have to fix this if we want it fixed in the near future. ----- Original Message ----- From: "Brian Hayes" <bg...@ke...> To: <dyn...@li...> Sent: Tuesday, September 30, 2003 5:49 AM Subject: RE: [Dynapi-Help] Rightclick events > 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 > Dyn...@li... > 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 > Dyn...@li... > https://lists.sourceforge.net/lists/listinfo/dynapi-help > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.522 / Virus Database: 320 - Release Date: 9/29/03 |
From: <bas...@ya...> - 2003-09-30 18:05:14
|
Hi Doug Thanks anyhow, you got me on the right track. Implementing your listener with a different condition works perfect, at least in MSIE 5.5: ondragstart:function(e){ if(event.button==2||event.button==3){ e.cancelDrag(); } } As my fix probably aint browsersafe, Im still looking forward to the bugfix though. For now I just need to figure out how to avoid the default browser contextmenu. Regards Brian Pedersen --- Doug Melvin <do...@cr...> skrev: > the following _should_ work but does not under IE 6. > > lyr.addEventListener({ > ondragstart:function(e){ > status=e.getButton(); > if(e.getButton() == "right"){ > e.cancelDrag(); > } > } > }); > > when in the ondragstart event, in the mouse_ie.js:MouseEvent.getButton() > returns left always. > Through debugging I noteied the the error condition on line: 26 "if > (!this._mouseEvent) return "ouch";" (I added the "ouch") > always returns "ouch" > > Works normally inside of a onclick event. (returns left, middle or right) > > Same deal in NS 4x, works correctly in onclick event, but executes error > code in ondragstart event at: > line 26 in mouse_ns4.js:getButton() "if (!this._browserEvent) return > "ouch";" (i added the ouch) > > Mozilla 1.x: Same deal again.. > > It seems obvious to me that this is a bug in the common base of the > dragevents scheme.. > > I am at work right now, and have no intoernet at home. > Someone else will have to fix this if we want it fixed in the near future. > ----- Original Message ----- > From: "Brian Hayes" <bg...@ke...> > To: <dyn...@li...> > Sent: Tuesday, September 30, 2003 5:49 AM > Subject: RE: [Dynapi-Help] Rightclick events > > > > 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 > > Dyn...@li... > > 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 > > Dyn...@li... > > https://lists.sourceforge.net/lists/listinfo/dynapi-help > > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.522 / Virus Database: 320 - Release Date: 9/29/03 > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Dynapi-Help mailing list > Dyn...@li... > https://lists.sourceforge.net/lists/listinfo/dynapi-help Yahoo! Mail (http://dk.mail.yahoo.com) - Gratis: 6 MB lagerplads, spamfilter og virusscan |
From: Doug M. <do...@cr...> - 2003-09-30 18:20:06
|
Okay.. I should check all message before ranting.. :-) See this: http://www.faqts.com/knowledge_base/view.phtml/aid/5693/fid/126 **Note to developers** in Dynapi 2.x we had built in function to stop context menu, but still allow capturing of right click.. Can we add that back in for 3.x? ----- Original Message ----- From: "Brian Pedersen" <bas...@ya...> To: <dyn...@li...> Sent: Tuesday, September 30, 2003 2:04 PM Subject: Re: [Dynapi-Help] Rightclick events: bug noted > Hi Doug > > Thanks anyhow, you got me on the right track. > Implementing your listener with a different condition works perfect, at least in > MSIE 5.5: > > ondragstart:function(e){ > if(event.button==2||event.button==3){ > e.cancelDrag(); > } > } > > As my fix probably aint browsersafe, Im still looking forward to the bugfix > though. > > For now I just need to figure out how to avoid the default browser contextmenu. > > Regards > Brian Pedersen > > --- Doug Melvin <do...@cr...> skrev: > the following _should_ > work but does not under IE 6. > > > > lyr.addEventListener({ > > ondragstart:function(e){ > > status=e.getButton(); > > if(e.getButton() == "right"){ > > e.cancelDrag(); > > } > > } > > }); > > > > when in the ondragstart event, in the mouse_ie.js:MouseEvent.getButton() > > returns left always. > > Through debugging I noteied the the error condition on line: 26 "if > > (!this._mouseEvent) return "ouch";" (I added the "ouch") > > always returns "ouch" > > > > Works normally inside of a onclick event. (returns left, middle or right) > > > > Same deal in NS 4x, works correctly in onclick event, but executes error > > code in ondragstart event at: > > line 26 in mouse_ns4.js:getButton() "if (!this._browserEvent) return > > "ouch";" (i added the ouch) > > > > Mozilla 1.x: Same deal again.. > > > > It seems obvious to me that this is a bug in the common base of the > > dragevents scheme.. > > > > I am at work right now, and have no intoernet at home. > > Someone else will have to fix this if we want it fixed in the near future. > > ----- Original Message ----- > > From: "Brian Hayes" <bg...@ke...> > > To: <dyn...@li...> > > Sent: Tuesday, September 30, 2003 5:49 AM > > Subject: RE: [Dynapi-Help] Rightclick events > > > > > > > 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 > > > Dyn...@li... > > > 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 > > > Dyn...@li... > > > https://lists.sourceforge.net/lists/listinfo/dynapi-help > > > > > > > > > --- > > Outgoing mail is certified Virus Free. > > Checked by AVG anti-virus system (http://www.grisoft.com). > > Version: 6.0.522 / Virus Database: 320 - Release Date: 9/29/03 > > > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > Welcome to geek heaven. > > http://thinkgeek.com/sf > > _______________________________________________ > > Dynapi-Help mailing list > > Dyn...@li... > > 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 > Dyn...@li... > https://lists.sourceforge.net/lists/listinfo/dynapi-help > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.522 / Virus Database: 320 - Release Date: 9/29/03 |
From: Raymond I. <xw...@ya...> - 2003-09-30 21:00:41
|
What's the code to stop context menu, but still allow capturing of right click? -- Raymond Irving --- Doug Melvin <do...@cr...> wrote: > Okay.. I should check all message before ranting.. > :-) > See this: > http://www.faqts.com/knowledge_base/view.phtml/aid/5693/fid/126 > > **Note to developers** > in Dynapi 2.x we had built in function to stop > context menu, but still allow > capturing of right click.. > Can we add that back in for 3.x? > > > ----- Original Message ----- > From: "Brian Pedersen" <bas...@ya...> > To: <dyn...@li...> > Sent: Tuesday, September 30, 2003 2:04 PM > Subject: Re: [Dynapi-Help] Rightclick events: bug > noted > > > > Hi Doug > > > > Thanks anyhow, you got me on the right track. > > Implementing your listener with a different > condition works perfect, at > least in > > MSIE 5.5: > > > > ondragstart:function(e){ > > if(event.button==2||event.button==3){ > > e.cancelDrag(); > > } > > } > > > > As my fix probably aint browsersafe, Im still > looking forward to the > bugfix > > though. > > > > For now I just need to figure out how to avoid the > default browser > contextmenu. > > > > Regards > > Brian Pedersen > > > > --- Doug Melvin <do...@cr...> > skrev: > the following > _should_ > > work but does not under IE 6. > > > > > > lyr.addEventListener({ > > > ondragstart:function(e){ > > > status=e.getButton(); > > > if(e.getButton() == "right"){ > > > e.cancelDrag(); > > > } > > > } > > > }); > > > > > > when in the ondragstart event, in the > mouse_ie.js:MouseEvent.getButton() > > > returns left always. > > > Through debugging I noteied the the error > condition on line: 26 "if > > > (!this._mouseEvent) return "ouch";" (I added the > "ouch") > > > always returns "ouch" > > > > > > Works normally inside of a onclick event. > (returns left, middle or > right) > > > > > > Same deal in NS 4x, works correctly in onclick > event, but executes error > > > code in ondragstart event at: > > > line 26 in mouse_ns4.js:getButton() "if > (!this._browserEvent) return > > > "ouch";" (i added the ouch) > > > > > > Mozilla 1.x: Same deal again.. > > > > > > It seems obvious to me that this is a bug in the > common base of the > > > dragevents scheme.. > > > > > > I am at work right now, and have no intoernet at > home. > > > Someone else will have to fix this if we want it > fixed in the near > future. > > > ----- Original Message ----- > > > From: "Brian Hayes" <bg...@ke...> > > > To: <dyn...@li...> > > > Sent: Tuesday, September 30, 2003 5:49 AM > > > Subject: RE: [Dynapi-Help] Rightclick events > > > > > > > > > > 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); > === message truncated === __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com |
From: <bas...@ya...> - 2003-09-30 17:52:19
|
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 <bg...@ke...> 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 > Dyn...@li... > 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 > Dyn...@li... > https://lists.sourceforge.net/lists/listinfo/dynapi-help Yahoo! Mail (http://dk.mail.yahoo.com) - Gratis: 6 MB lagerplads, spamfilter og virusscan |
From: Doug M. <do...@cr...> - 2003-09-30 18:16:11
|
there is a bug in the mouse events that makes my code not work. the idea is whena drag starts (ondragstart) check if the user is clicking the left button (you wanted drag on left button no?) it the user is NOt using the left buttont hen cancel the drag (prevents dragging). If you want drag on right and not left the yes, change "left" to "right".. but again.. While I know that my code does not fix your problem, this is due only to a bug. I mainly posted the code and info so that other developers will know of the bug and maybe fix it.. At any rate.. you may also try putting my code in a onmousedown event instead of dragstart. And as always.. READ THE CODE.. It's not too hard to open up the mouse_x.js or the dragevent.js code and see how it works.. ----- Original Message ----- From: "Brian Pedersen" <bas...@ya...> To: <dyn...@li...> Sent: Tuesday, September 30, 2003 1:51 PM Subject: RE: [Dynapi-Help] Rightclick events > 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 <bg...@ke...> 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 > > Dyn...@li... > > 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 > > Dyn...@li... > > 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 > Dyn...@li... > https://lists.sourceforge.net/lists/listinfo/dynapi-help > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.522 / Virus Database: 320 - Release Date: 9/29/03 |
From: <bas...@ya...> - 2003-09-30 18:23:37
|
Hi Doug No offence but my mail starts with 'Hi Brian' and was in reply to a mail from Brian Hayes. I have also sent a reply to you in which I thank you for your reply and aknowledge the quality of the content. So as you hopefully might have noticed, I have read the code :) Thanks again Brian Pedersen --- Doug Melvin <do...@cr...> skrev: > there is a bug in the mouse events that makes my code not work. > the idea is whena drag starts (ondragstart) check if the user is clicking > the left button (you wanted drag on left button no?) > it the user is NOt using the left buttont hen cancel the drag (prevents > dragging). > > If you want drag on right and not left the yes, change "left" to "right".. > > but again.. While I know that my code does not fix your problem, this is due > only to a bug. > > I mainly posted the code and info so that other developers will know of the > bug and maybe fix it.. > > > At any rate.. you may also try putting my code in a onmousedown event > instead of dragstart. > > And as always.. READ THE CODE.. > It's not too hard to open up the mouse_x.js or the dragevent.js code and see > how it works.. > > ----- Original Message ----- > From: "Brian Pedersen" <bas...@ya...> > To: <dyn...@li...> > Sent: Tuesday, September 30, 2003 1:51 PM > Subject: RE: [Dynapi-Help] Rightclick events > > > > 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 <bg...@ke...> 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 > > > Dyn...@li... > > > 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 > > > Dyn...@li... > > > 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 > > Dyn...@li... > > https://lists.sourceforge.net/lists/listinfo/dynapi-help > > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.522 / Virus Database: 320 - Release Date: 9/29/03 > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Dynapi-Help mailing list > Dyn...@li... > https://lists.sourceforge.net/lists/listinfo/dynapi-help Yahoo! Mail (http://dk.mail.yahoo.com) - Gratis: 6 MB lagerplads, spamfilter og virusscan |