How to implement the cut / copy / paste / selectall menu for textarea and webtextarea when i right click the mouse. This was there bu default in the editfiled but now that is depreceated. I need it both for desktop and web application.
For desktop check Popup at http://documentation.xojo.com/index.php/MenuItem
For Web see http://documentation.xojo.com/index.php/WebMenuItem WebControl.ContextualMenu.
it is still there in the Desktop TextArea.
You won’t be able to control the clipboard from a web app, so implementing your own contextual menu will not work.
You will have to turn the system-provided one back on because Xojo turns it off.
Place a WebCanvas overlaid on top of the WebTextArea. That reinstates the browser right click contextual menu.
[quote=259606:@Tim Parnell]You won’t be able to control the clipboard from a web app, so implementing your own contextual menu will not work.
You will have to turn the system-provided one back on because Xojo turns it off.[/quote]
I just told you how to, no need for JS :
I kinda like Michel’s suggestion. Sounds like you can implement it on a field-by-field basis. Unfortunately… I’ve not been able to make it work. Perhaps Michel could elaborate. I’ve placed a WebTextArea on a form. What exactly does he mean by Placing a WebCanvas “overlaid” on top of the WebTextArea? I’ve placed a WebCanvas on my form…I can’t get the browser right-click to work on that object. If I place the WebCanvas over my WebText Area…how can a person type in the WebTextArea? I can set the visibility for False…and this allows my to type in the underlying field…but I still get no browser right click menu. I’ve tried most combinations I can think of except maybe rendering the textfield “inside” the WebCanvas.
Indeed I just tried in the very latest version of Xojo, and it does not work.
The solution is to use the MouseDown event and check for Details.RightMouseButton, then display a Xojo contextual menu.
Feedback report for contextual menu: feedback://showreport?report_id=23071
Doesn’t mention that it should be an option, but add points to it if you need the menu.
Also, Xojo is a name and should not be in all caps
A quick glance at the frameworks seems to indicate Xojo has placed a hook on the event. Probably to manage the right click. It maybe possible to take over that, but it may also break things in Xojo.
A feature request seems in order to have an option to reinstate the default right click contextual menu.
Thanks for your responses experts. I’ll update the XOJO…errr…I mean Xojo feedback case as I think this would be handy.
I used the browser developer tools to take a peek at the framework as well. I hadn’t found the hook in the framework yet when I noticed Michel’s reply. Thanks again TIM & Michel.
There are 4 listeners in framework.js for contextmenu. I have absolutely no idea about how to short circuit that.
I’m not looking at the js framework right now, but there is a removeEventListener function.
Sure. But here is the kind of listener the framework uses :
It is not exactly the same kind of object as what W3School cites as example. Besides, I do not like the idea to start doing surgery on the framework itself. God knows what it can break.