Friday, July 11, 2014

Re: how to disable backspace button in gwt?

Hi,
Yeah i have added this listener see the code,

 Event.addNativePreviewHandler(new NativePreviewHandler() {
       @Override
       public void onPreviewNativeEvent(NativePreviewEvent event) {
           if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_BACKSPACE) {
               if (event.getNativeEvent().getEventTarget() != null) {
                   Element as = Element.as(event.getNativeEvent().getEventTarget());
                   boolean readOnly = as.getPropertyBoolean("readOnly");
                   boolean contentEditable = as.getPropertyBoolean("isContentEditable");
                   if (readOnly || !contentEditable) {
                       event.getNativeEvent().stopPropagation();
                       event.getNativeEvent().preventDefault();
                   }
               }

           }
       }
   });

Backspace issue is solved but one more issue its creating in IE.The error message says "
  • Make sure the web address //ieframe.dll/dnserror.htm# is correct." when i click the hyperlink(see the attched image).Thanks for your reply


On Friday, July 11, 2014 2:48:29 PM UTC+5:30, Mohammed Sameen wrote:
Hi! 

My application does not need have any history 
support. 
The problem is that when I type something wrong in textbox,its shows warning in dialogbox and accidentally lose focus and 
then press Backspace key to delete a character from textbox,browser performs application to exit and the whole application is unloaded losing all the 
data. 

How can I disable this?Please give me suggestion.

Thanks! 

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment