Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
bert2002
Posts: 172
Registered: ‎05-01-2010
My Device: Z10
Accepted Solution

Disable Text selection

Hi,

 

how can I prevent the text selection in a webworks application? I found a article from

 

many thanks.

 

bert

 

 



----------------------------------------------------------
find my widgets -> http://blackberry.itbert.de
Retired
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: Disable Text selection

The KB article provided shows how to disable default browser behaviors by using JavaScript, specifically the preventDefault method available on each touch event.

 

You should be able to disable text selection, if you add the following JavaScript to your page. 

 

document.addEventListener("touchstart", function(e) { e.preventDefault(); }, false);
document.addEventListener("touchmove", function(e) { e.preventDefault(); }, false);

 

Note: This will also disable other behaviors that you may not wish for your application - or you may (e.g. the above code snippet will also disable scrolling and pinch-to-zoom.

 

 

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Regular Contributor
liammccann
Posts: 68
Registered: ‎06-12-2012
My Device: Blackberry Bold 9780

Re: Disable Text selection

How do i just disable the blue selector coming up? but keep evyerthing else?

Retired
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: Disable Text selection

Are you referring to focus-mode navigation?

 

I believe the following meta tag is still supported:

<meta name="x-blackberry-defaultHoverEffect" content="false" />

 

Also see the documentation on focus navigation for more info:

https://developer.blackberry.com/html5/documentation/ww_developing/using_the_navigation_mode_1866978...

 

Finally, here are some sample apps on the topic:

http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/How-to-use-Navigation-Mode-in-a-...

 

Good luck!

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Regular Contributor
liammccann
Posts: 68
Registered: ‎06-12-2012
My Device: Blackberry Bold 9780

Re: Disable Text selection

Sorry for the confusion,

https://www.dropbox.com/s/hgqsl7gabbte82k/2012-07-19%2009.04.37.jpg

This is what i mean , shown on the image above, i am not using focus navigation as its the playbook im using. Im trying to get rido f the blue selector on the image... Please look
Retired
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: Disable Text selection

Oh I understand what you mean now.

 

You can't disable that selector.  Its part of the default virtual keyboard input mechanism for PlayBook.

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.