For anyone interested, here is one solution:
static native void nativeFocus(JavaScriptObject o)/*-{
try{o.focus();}catch(e){}
}-*/;
static void SetFocusToSelectedTab(TabBar tb){
final NodeList<Element> nl = tb.getElement
().getElementsByTagName("div");
final int cItems = nl.getLength();
for(int i=0;i<cItems;i++){
if (nl.getItem(i).getClassName().indexOf("gwt-TabBarItem-
selected")>=0){
nativeFocus(nl.getItem(i));
break;
}
}
}
On Oct 21, 8:51 am, BryanDavid <[email protected]> wrote:
> There is no TabPanel.setActiveTab. There is, however a
> TabPanel.selectTab
>
> The problem is not selecting a tab, but getting the keyboard focus on
> to one of the TabBar.Tab objects.
>
> On Oct 21, 1:18 am, Akash <[email protected]> wrote:
>
> > I think method you are looking for is tabPanel.setActiveTab();
>
> > On Oct 21, 6:10 am, BryanDavid <[email protected]> wrote:
>
> > > Hello,
>
> > > The TabBar tabs have the ability to have keyboard focus, and if you
> > > click on one, it will get the dotted outline showing keyboard focus.
> > > This is great since I can then use a KeyDownHandler to have hot keys
> > > do something on the selected (and focused) tab.
>
> > > However, when I call tabBar.selectTab(n) from code, the focus is not
> > > set to the tab, and I cannot find a way to place it there via code.
> > > There is no corresponding tabBar.focusTab(n) method.
>
> > > TabBar.Tab does not implement Focusable, and neither does TabBar, and
> > > this is confusing. I expect to be able to call tabBar.getTab(n).focus
> > > () but no deal.
>
> > > I tried using DomEvent.fireNativeEvent to send a click event with the
> > > Label widget contained inside the TabBar.Tab, however, this had no
> > > effect that I could see.
>
> > > It seems that this should be simple and I am missing something
> > > obvious.
>
> > > Any help?
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---