how to disable copy/cut/paste option on mgwt MTextBox and MPasswordTextBox

75 views
Skip to first unread message

Arun Kumar

unread,
Apr 2, 2014, 10:57:19 AM4/2/14
to google-we...@googlegroups.com
hi
     I developed an mgwt app with gwt-phonegap ,I installed it in ios device.I want to disable copy & cut & paste options to my text fields. Is there any possible to do it from css,if not please give me any other solution. 

thanks in advance,
Arun Kumar

Jim Douglas

unread,
Apr 2, 2014, 11:30:30 AM4/2/14
to google-we...@googlegroups.com
I disable those events in my code in order to override them and provide enhanced functionality.  Just blocking them is generally a bad idea; it annoys the user.

But the general approach would be to register for the events you want to block, and call event.preventDefault() to suppress the default behaviour.  For ONPASTE, this is trivial.  GWT doesn't expose ONCUT or ONCOPY, so you'll need some JSNI for those.  I posted some sample code here:

Jens

unread,
Apr 2, 2014, 12:05:11 PM4/2/14
to google-we...@googlegroups.com
 GWT doesn't expose ONCUT or ONCOPY, so you'll need some JSNI for those.

With GWT 2.6 you don't need JSNI anymore to introduce events that GWT does not know about out of the box. Just extend DomEvent (just like ClickEvent, etc) and use addBitlessDomHandler to register the handler of your custom event. 


-- J.
Reply all
Reply to author
Forward
0 new messages