Browser Context Menu customization? - browser

Is there a way to override the "undo" and "select all" in right click context menu of the browser over textarea?
Thank you.

You cannot edit the browser's built-in context menu, but you can disable it and replace it with your own using the oncontextmenu event on the window object. I would caution that this is often a bad idea. Users expect to find the built-in context menu and are often frustrated when it isn't there.

I know you can prevent the whole context menu from opening by registering to the click() event, doing some cross-browser mumbo-jumbo to get wich button was clicked, and then return false if the right one was clicked.
However, I don't think it's possible to modify the context menu itself, at least not using javascript.
I should add that you may want to rethink why you're doing this. This will never be a protection against anything (some try to prevent copying images from their website), as it may simply be disabled by turning javascript off.
UPDATE: Ok, so you don't want to prevent users to do things, bug have them doing things your way. Then, I guess the best thing to do is :
Provide users with a toolbar that allow them to do these things (and thus making them use your actions instead of the default one
Map the usual keyboard shortcuts to your actions (Ctrl+A, Ctrl+Z, etc...)
Replace the right click menu with your own.
You mentionned in another comment that you cannot reproduce copy/paste, which is correct, but you can implement you own clipboard (that will only work for your webapp) if you really have to.

Related

Linux - Any way to configure or create a script/program to make right click not select menu item?

The default behavior for right-clicking on most recent Linux distros is to select a menu item in a right-click menu upon releasing the right mouse button. While this saves some mouse presses, it is driving some of my Windows-trained (and rather vocal) coworkers completely bonkers, and a lot of searching has told me that there is no option to change this behavior in the distros they are using (mostly RHEL 6).
To make my work environment a little less volatile I would like to try to program a fix or patch for their systems to make right clicking work like they are used to (the menu does not even appear until the right mouse button is released), but I don't know what kinds of tutorials I should be looking for (shell scripts? C? etc.) in order to do this.
If I could be pointed in the right direction that would be lovely! (or if someone by chance already knows of a fix, that would work too, though a lot of Googling has told me that there does not appear to be one currently)
Follow the directions here:
https://unix.stackexchange.com/questions/20550/how-to-disable-the-forward-back-buttons-on-my-mouse
But instead of disabling the forward and back buttons, disable the right click mouse button. You can easily dump the resulting command into a shell script which calls xmodmap. Then you can make icons that disable and enable the right mouse button, for the times where they will need it.

Recommendation for a multi-instance jquery dialog/overlay

Ok. had enough of trying out lightboxes, overlays and dialog boxes plugins. The problem is that very few of them support nested (multiple) dialog open at the same time - a typical requirement in my opinion.
I'm looking for a recommendation for a simple plugin that:
supports callsbacks for the usual onShow/onLoad... events
supports nested instances i.e. the user open a dialog, clicks a button on it, another dialog opens up while keeping the first one open in the background. In other words, it should support the closure of each instance programatically
is NOT the jquery ui dialog plugin
This came about after the big disappointment with SimpleModal's inability to support multiple modal boxes open simultaneously!!!! #EricM, why would you do that to me? why???? ;)
I have narrowed it down to jqModal and the jquery tools overlay. The usage of the latter is weird. Maybe i'm tired but i just don't get it.
So before i dive into jqModal, does anyone have any recommendation based on personal experience that will achieve what I'm trying to do?
thanks

Tcl/Tk widgets and FocusOut not working as expected on linux

Do anyone know why FocusOut event is not working on linux?
I have 1 enabled textbox and 3 disabled combobox.
I bind the textbox with FocusOut event where it will call a proc that enables or disables the 3 combobox.
It works perfectly on Windows. However, it doesn't seem to trigger the FocusOut event when this action is done on Linux. One weird thing is that if I click on buttons, FocusOut event seems to be triggered.
Could it be because my combobox are disabled?
But why does it work on Windows?
I really hope someone can help me please.
Thanks in advance.
I have observed in the past that some window managers steal the focus temporarily from Tk on each button click before setting it back; I suspect that this has to do with the way that key event handling works, but I am unable to check at the moment (due to being on OSX, where things are different). Because of the complexities involved, I'd suggest that if you bind to <FocusOut>, you should also check whether you get a <FocusIn> event shortly after; a little extra delay (e.g., 0.1s) before doing the update of the buttons' disabled status will not hurt.
Or you could hang the code to do the disabling off the entry widget validation engine, perhaps like this:
.e configure -validation focusout -validatecommand doButtonEnableDisable
The validation interface is the same for both the old style entry and the new style ttk::entry widgets. It's also supported by spinboxes. Just be aware that you need to return a boolean true from doButtonEnableDisable or you'll reject the change to the entry, and you should take care to ensure that your code does not produce an error or it will disable itself; the docs list the things to watch out for.

Alternatives to Struts-Menu for Menus in Struts 2.X Application

Per user feedback, I am opening a new question for this topic.
So I am currently using Struts-Menu to handle my menu needs for my Struts 2 J2EE application. It is not necessarily a package I wish to work with I have found by playing around with it. So what are some alternatives to this package? I immediately flocked to Struts-Menu because I saw a fair amount of web search traffic pointing to it, including those who use Struts2. What I am worried about is difficulty in the future of making it work with other packages, given its 2007 last update and the extra tap dance I had do to make it work with my configuration. It seems too fragile at this point for my taste.
I have several different menus in my app, but the one I am specifically addressing at the present is like this ... The top level menu drops down upon mouse hover over it. The submenus expand horizontally upon mouse hover. Exactly one menu item can be selected as no radio buttons or check boxes are contained in the menu. This particular menu does not require db access to populate its children. It works sort of like Velocity CoolMenus4 from the Struts-Menu demos.
I've never used struts-menu, but it looks like overkill to me.
I would recommend that you locate a menu that you like and then write a tag file to handle outputting it in your view layer. To me, that's a lot easier than using a framework or library just to output a menu. Plus, its specific to the actual menu you want to use. Your tag can handle doing security checks to ensure that the user only sees what they have permission to access, etc.

Remove ability of a Usercontrol to get focus

while designing my user control, i encountered the following problem:
i would like to set the UserControl.CanGetFocus to false, which is not possible due an error message telling me that a control unable to receive focus can not contain elements who are able to receive focus.
but as i don't want them to actually receive any focus, i would like to disable this for the child-objects as well as for my user control. i can barely believe that there's no possiblity to prevent the child-controls to receive focus, no matter of what type they are? i currently use imageboxes and pictureboxes.
already searched using google, always leading to the result that the property cannot be set to false under these conditions...
If you put the picturebox in a frame and the disable the frame then it will not receive mouse events. Doing this in combination with setting the tabstop to false will prevent the picturebox from receiving focus.
I've used this technique in the past to create a checkbox usercontrol that can be made read-only.
You can set the TabStop property of the childcontrol to False.
Have you tried just using Image controls? If I recall correctly they're lightweight and shouldn't capture focus, whereas a PictureBox is always going to be able (in theory) to capture focus. Depending on your need, this may be sufficient.
Can you set an enabled property to false?
You might want to look at this article.
http://support.microsoft.com/kb/180216
Sounds like you have a problem. The only known workaround is to set the UserControl's Enabled property to False instead of setting the CanGetFocus property. But then, of course you would not be able to respond to clicks and things.
It's been a while, but the solution to this that we used for years was to catch the received-focus event (sorry, can't remember what it is) and then explicitly force th focus to something else. It's kludgey, and not easy (because of the vagaries of event-ordering and reordering in VB/Com Windows), but it got the job done.

Resources