开发者

Intercept click over label widgets

tyrpx is a GWT / Google App Engine app that allows players to do typing races. I am trying to prevent people from selecting text to type (it's a quote). The quote is made of GWT labels. Is there a way to prevent people to select text? of to intercept a clic开发者_StackOverflowk over a panel or label?

See it here http://app.typrx.com then click on 'compete in a race'.

Thanks.


You can make text unselectable via CSS using either/both of these:

user-select: none;
-moz-user-select: none;

http://www.w3.org/TR/2000/WD-css3-userint-20000216#user-select


I've had the same issue and added a solution to the http://www.cobogw.org library. It handles all the browser specific implementations. You can add the library to your project or see how it's implemented and copy it to your own code. The method to use is:

CSS.setSelectable(getElement(), false);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜