Focus on a first element

Timofej Dorofejev30 Nov 2009 9:37 AM
Hi,

is there any way to make focus always appear on a first view element? first_element.focus() in updateView() works, but not always, if you have a grid and buttons below, grid.focusCell(0) works only if the focus should have been on one of the grid elements, if it should have been on one of the buttons, it remains there.
Steve30 Nov 2009 9:42 AM
QUOTE (hriuki @ Nov 30 2009, 09:37 AM) <{POST_SNAPBACK}>
Hi,

is there any way to make focus always appear on a first view element? first_element.focus() in updateView() works, but not always, if you have a grid and buttons below, grid.focusCell(0) works only if the focus should have been on one of the grid elements, if it should have been on one of the buttons, it remains there.

Have you tried overriding the focusView method in your view, and setting focus to the first element there? See pg 178 of the dev guide.
Timofej Dorofejev1 Dec 2009 2:47 AM
QUOTE (Steve @ Nov 30 2009, 09:42 AM) <{POST_SNAPBACK}>
Have you tried overriding the focusView method in your view, and setting focus to the first element there? See pg 178 of the dev guide.


Yes, thanks, that works, but only if the view has already been created. If the view is opened for the first time, the focus is still on the back button. Is there any way to override that?
Steve1 Dec 2009 3:27 AM
QUOTE (hriuki @ Dec 1 2009, 02:47 AM) <{POST_SNAPBACK}>
Yes, thanks, that works, but only if the view has already been created. If the view is opened for the first time, the focus is still on the back button. Is there any way to override that?

Try overriding the setInitialFocus method.
Jeremy Johnstone2 Dec 2009 4:29 PM
focusView is called even for first focus. It is always the last thing to be called when focus is coming into the widget from outside. Can you please give me some sample code so I can help you figure out what's wrong?

-Jeremy
Timofej Dorofejev15 Dec 2009 5:04 AM
QUOTE (Jeremy Johnstone @ Dec 2 2009, 04:29 PM) <{POST_SNAPBACK}>
focusView is called even for first focus. It is always the last thing to be called when focus is coming into the widget from outside. Can you please give me some sample code so I can help you figure out what's wrong?

-Jeremy


Yes, sure.

CODE
focusView: function() {
this.controls.what_is_button.focus();
}


This code works fine only when the view has been already created, but when it it opened for the first time, the focus is on the back button.

Thanks,
Tim
Jeremy Johnstone16 Dec 2009 5:02 PM
Sounds like a bug. I'll investigate. Please provide me the following versions:

Ubuntu
Framework
WDK
Dev Onescreen29 Sep 2011 5:53 PM
I&#39;m having the same problem. Was there a solution?<br><br><div class="quote "><div class="quotetop ">QUOTE<cite>(Jeremy Johnstone @ 16 Dec 2009 5:02 PM)</cite><blockquote class="quotemain">Sounds like a bug. I&#39;ll investigate. Please provide me the following versions:<br><br>Ubuntu<br>Framework<br>WDK</blockquote></div></div>