onTabSelected change the TabBar widget

45 views
Skip to first unread message

ArunDhaJ

unread,
Oct 23, 2008, 9:44:10 AM10/23/08
to Google Web Toolkit
Hi All,
On selecting a TabBar how to change the Widget?

Actually I'm having 3 sets of picture to show the TabBar in selected
mode and another 3 sets of picture for TabBar in unselected mode.

Upon loading I'm creating an HTML widget with tab_left, tab_center and
tab_right image and repeating tab_center image till the required
length.

When I select the TabBar I need to create another HTML widget with the
other three sets of images.

Using style sheet we can specify only one image but in my case I need
to replace 3 images.

How to change the HTML widget in selected state to unselected state?


In TabListener's onTabSelected event we can only get the HTML using
tabPanel.getTabBar().getTabHTML(tabIndex));

is there any way to set the HTML??


Thanks in Advance !
-ArunDhaJ

Bakulkumar

unread,
Oct 24, 2008, 3:51:32 PM10/24/08
to Google Web Toolkit
try adding image on tab bar and then change the url of image on tab
change.

Like:
Image[] images = new Image[n];
images[0] = new Image();
img1.setURL("active.png");
tabBar.addTab(img1);

images[1] = new Image();
images[1].setURL("inactive.png");
tabBar.addTab(images[1]);

and so on for rest of the tab.

and then on tabChange:

public void onTabSelected(SourcesTabEvents bar, int index) {
images[index].setURL("active.png");
//set url of other images to 'inactive.png'
}


-Bakul
Reply all
Reply to author
Forward
0 new messages