Adding close button to TabPanel(to its TabBar exactly)

1,833 vistas
Ir al primer mensaje no leído

nandini

no leída,
2 abr 2008, 8:06:11 a.m.2/4/08
para Google Web Toolkit
Hi..........

I have started to work on gwt and have some issue.
I have created a TabPanel in my sample code.Now I want to add a close
button image to be added in the TabBar on clicking of which the tab
show get closed....Can ny one help with respect to this........

thanks in advance.............

Nandini

Carl Scott

no leída,
2 abr 2008, 11:42:42 p.m.2/4/08
para Google Web Toolkit
It's not inherently supported. Only thing I can think to do within
the GWT scope is to inject regular HTML into the tab that has an image
that, onclick, makes a call to a javascript function, say,
tabClose(). use JSNI to hook tabClose() to the $wnd object, and have
tabClose call a function that does something meaningful, like hide/
remove the tab. Somewhat annoying but would work.

MyGWT's framework, on the other hand, inherently, and nicely, supports
this, so it may be worth checkout out. Just google mygwt. I use it
currently in my projects, and before that I implemented my own
tabPanel to support the extra functionality I needed.

--
Carl Scott
Software Developer, Solertium Corporation
Se borró el mensaje

mooner

no leída,
3 abr 2008, 5:12:07 a.m.3/4/08
para Google Web Toolkit
You can create close button using DOM object:

// Create tab
myTabPanel.insert(myWidget, "<span id=\"tab123\" />", true,
myTabIndex);

// Create close button
Element closeElement = DOM.createImg();
// set image properties
DOM.setElementProperty(closeElement, "width", "16");
// ...

DOM.setEventListener(closeElement, new EventListener() {
public void onBrowserEvent(Event event) {
myTabPanel.remove(myTabIndex);
}
});
DOM.sinkEvents(closeElement, Event.BUTTON_LEFT);

Element tabElement = DOM.getElementById("tab123"); // Find placeholder
for close button of created tab
DOM.appendChild(tabElement, closeElement); // Append close button

gregor

no leída,
3 abr 2008, 6:53:04 a.m.3/4/08
para Google Web Toolkit
You can also also use TabPanel.add(Widget,Widget) where the second
Widget is the tab header. This can be e.g. a HorizontalPanel with text
aligned left and a close icon button aligned right. Add a
ClickListener to this that closes the tab.

regards
gregor

sandeep adari

no leída,
1 jul 2013, 12:40:42 p.m.1/7/13
para google-we...@googlegroups.com,Google Web Toolkit,nandi...@gmail.com
just try with tapPanel object say tabPanel.setClosable(true);
This statement should provide the close button as you are expecting.

sandeep adari

no leída,
1 jul 2013, 12:41:30 p.m.1/7/13
para google-we...@googlegroups.com,Google Web Toolkit,nandi...@gmail.com
just try tabPanel.setClosable(true);


On Wednesday, 2 April 2008 17:36:11 UTC+5:30, nandini wrote:
Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos