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

Native Development

Reply
New Contributor
Posts: 3
Registered: ‎10-29-2013
My Device: Q10, Z10
My Carrier: Orange

Autofocus on text field Q10

Hi,

 

I'm developing an app for Blackberry Q10 (my current version of SDK is 10.1).

I have a textfield on a seachpage. Is it possible to set an autofocus and highlight directly when the page load ?

 

I've found a solution for Blackberry Z10 but it doesn't work on Q10. Here is my QML code :

 

import bb.cascades 1.0

Page {

onCreationCompleted: { search.showVirtualKeyboard(); searchfield.requestFocus(); } Container { focusPolicy: { if (readyForFocus) {
searchfield.requestFocus(); } } TextField { id: searchfield hintText: "Search" inputMode: TextFieldInputMode.Text }
}
}

 

Thank you for your help,

 

 

Samantha

 

Retired
Posts: 252
Registered: ‎08-17-2012
My Device: BlackBerry Z10 and Q10
My Carrier: Bell

Re: Autofocus on text field Q10

Hi Samantha,

 

There shouldn't really be a differnce between how API's are used between the Q10 and the Z10 as long as you are placing the assets in the 720x720 asset folder for the Q10.

 

The documentation of the requestFocus property of Control has great examples on how to request focus for a control: http://developer.blackberry.com/native/reference/cascades/bb__cascades__control.html#function-reques...

@SamarAbdelsayed

Did this answer your question? Please accept post as solution.
Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker