hi Unfortunately there is no universal way to disable text selection via mouse dragging that works in all browsers.
If I recall correctly to disable text selection one must add the event listener that Sumit suggests, but this only applies for Ie and maybe opera. For the others one must add a css property. I can't recall the exact property names but do a quick search on mozillas mdc to get the css property name for ff and repeat for webkit. The FF property was called sonethi g all g the lines of "moz- selection"... Hth Mp On Jun 3, 6:21 am, Sumit Chandel <sumitchan...@google.com> wrote: > Hi Suren, > Unfortunately, disable text selection on double click is one of those things > that is hard to prevent across all browsers. I tried a couple of > implementations to disable text selection on double-click, but neither of > them worked. > > However, you can use an onselectstart='return false;' attribute which does > seem to work on IE6/7 and Chrome (see code snippet below). Although this > works on Chrome (which is WebKit-based), you'll have to try it out on Safari > to see if it works there as well. This definitely doesn't work on FF3, so > that may hinder your decision to depend on the onselectstart attribute for > text selection prevention. > > HTMLPanel panel = new HTMLPanel("<div id='grid' onselectstart='return > false;'></div>"); > Grid grid = new Grid(10, 10); > for (int i = 0; i < 10; i++) { > for (int j = 0; j < 10; j++) { > grid.setText(i, j, "Bonjour"); > } > } > panel.add(grid, "grid"); > > As a sidenote, you may not necessarily want to disable text selection in the > grid, however. It's generally not a good idea to go against standard browser > functionality that users may have grown accustomed to in their web browsing > experience. > > Hope that helps, > -Sumit Chandel > > On Wed, May 27, 2009 at 8:00 PM, Suren <nsurendi...@gmail.com> wrote: > > > Hi All, > > > I am having a grid with 100 columns. Among these certain columns are > > meant for readonly purpose. For these columns I want to disable the > > text selected when user tries to double click on that cell. > > > Currently when a user double click any cell in the Grid, the text get > > selected with blue background. I want to disable this functionality > > for certain cells / entire columns. > > > Can anyone help me in this regards > > > Thanks > > Suren --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---