Forum  Commercial Foru...  Commercial Foru...  RichTextBox Prevent Browser Contex Menu
Previous Previous
 
Next Next
New Post 5/9/2012 7:18 AM
  grsgrs
39 posts
No Ranking


RichTextBox Prevent Browser Contex Menu  

Hi

How can I disable RichTextBox Prevent Browser Contex Menu on right Mous Button, like it's down on TextBox, where a contextmenu is provided

Thanks

 
New Post 5/9/2012 1:20 PM
  palli
14324 posts
1st Level Poster




Re: RichTextBox Prevent Browser Contex Menu  

 Hi Gunter,

With reference to the demo application you were using in your other thread here, then in the overridden html resource, you can place a oncontextmenu="return false;" on the body node, just to prevent the contextmenu from showing. 

If you want to do something else, you can for instance place a oncontextmenu="return RichTextBox_RightClick(event,window);", and then do your 'stuff' within this new RichTextBox_RightClick javaScript method, which you must create. Remember to return false at the end of it.

Hope this helps,

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
New Post 5/10/2012 6:05 AM
  grsgrs
39 posts
No Ranking


Re: RichTextBox Prevent Browser Contex Menu  

Hi Palli

this is working perfectly with IE, but not with FF. FF is ignoring oncontextmenu. Any attempt for FF, which is working in a on VWg Test Environment (onmousdown, onmouseup etc.), is not working within VWG. any idea?

Thanks Gunter

 
New Post 5/10/2012 1:18 PM
  palli
14324 posts
1st Level Poster




Re: RichTextBox Prevent Browser Contex Menu  

 Hi Gunter,

Welcome to the world of browser differences.

As soon as you start customizing client side resources, you must also prepare yourself for having to dig, debug and test the different browsers for different reaction to your changes, and this case is no different. 

There are various tools that you should learn how to use, like FireBug for instance, and for IE, you can use script debugging directly inside Visual Studio. There are also quite useful websites with references and difference reports between browser and the one I most often use is www.dottoro.com, or more precisely, their reference at help.dottoro.com. This is a great reference site. Also, W3Schools is a good reference site.

In this particular case, I simply started the application inside of FireFox and set breakpoints inside the scripts on some key functions and soon found out that FireFox does not fire the oncontextmenu event, rather it simply fires the onclick event for right clicks on the RichTextBox. In order to fix that, cross browser (hopefully), I think it would be the simplest fix to cancel the event bubbling of the click event within the RichTextBox_Click JavaScript method. We are already handling the click event, which means we don't want it to bubble up the DOM and fire on some other element anyway. In order to do that, add the following as the last statement within RichTextBox_Click:

mobjApp.Web_EventCancelBubble(objEvent);

Hope this helps,

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
Previous Previous
 
Next Next
  Forum  Commercial Foru...  Commercial Foru...  RichTextBox Prevent Browser Contex Menu
.NET HTML5 Web, Cloud and Mobile application delivery | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2012 Visual WebGui®       Visual WebGui weblog on ASP.NET Gizmox Blog Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS