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

Java Development

Reply
Regular Contributor
Posts: 59
Registered: ‎03-06-2012
My Device: 9700
My Carrier: airtel
Accepted Solution

Start of app set the focus to some field

Hi All,

 

  I have the ui like native calendar

   At the start of the app i want the focus to be set to a labelfield with time 7:00.I have around 24 labelfields.How can i prform this action?

Developer
Posts: 16,786
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Start of app set the focus to some field

put it into the constructor, for example.
another option would be http://www.blackberry.com/developers/docs/7.1.0api/net/rim/device/api/ui/Screen.html#onUiEngineAttac...
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Regular Contributor
Posts: 59
Registered: ‎03-06-2012
My Device: 9700
My Carrier: airtel

Re: Start of app set the focus to some field

onUiEngineAttached how can i use this to set focus to some specific labelfield?
Developer
Posts: 16,786
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Start of app set the focus to some field

by calling setFocus on the field.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Regular Contributor
Posts: 59
Registered: ‎03-06-2012
My Device: 9700
My Carrier: airtel

Re: Start of app set the focus to some field

can u pls show a snippet ,i am not clear with this
Developer
Posts: 16,786
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Start of app set the focus to some field

et voila:

labelField1.setFocus();
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Regular Contributor
Posts: 59
Registered: ‎03-06-2012
My Device: 9700
My Carrier: airtel

Re: Start of app set the focus to some field

I meant how to use this onUiEngineAttached ?
Highlighted
Developer
Posts: 16,786
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Start of app set the focus to some field

protected void onUiEngineAttached(boolean attached){
if (attached){
labelField1.setFocus();
}
}
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Regular Contributor
Posts: 59
Registered: ‎03-06-2012
My Device: 9700
My Carrier: airtel

Re: Start of app set the focus to some field

[ Edited ]

what should be the vaue for attached ?always true?

Developer
Posts: 16,786
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Start of app set the focus to some field

the method is called by the system, the value depends on what is happening. take a look at the API docs.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter