-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi All,
How would I add an event which captures the onBlur(?) (really de-focus) of a tab from one to another?
Ive tried:
Tab t = mainWindow.getSelectedTab(); t.addEventListener(Events.ON_BLUR, new EventListener() { public void onEvent( Event event ) throws UiException { System.out.println("BLUR TAB!!!!!!!!!!!!!!!!!>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<"); } });
But it didnt work.
Thanks!
Thanks for that, but I want to add an event to the leaving tab.
For example:
TAB1 has a timer which is running, when the user moves to TAB2 I want the timer to stop
That sounds good - thanks samchuang.
Okay, another Tab question:
Say you have 2 tabs open and the second one selected. You close the second one and ZK changes the focus to the first one, this doesnt fired on the onSelect Event, how do I capture this event? (The Tabs are dynamically created)
Think Ive figured it out:
Pseudo code:
// * Find the next tab which will be selected after this one is closed
// * Save the index of the next selected tab
// * Find the tab box of the next selected tab
// * Find the tab panels from the tab box
// * Loop thru the tab panels and check their index with the next selected tab's index
tab.addEventListener(Events.ON_CLOSE, new EventListener() { public void onEvent( Event event ) throws UiException { // Because there is no direct link between Tabs and a TabPanel, we need to // do the following: // * Find the next tab which will be selected after this one is closed // * Save the index of the next selected tab // * Find the tab box of the next selected tab // * Find the tab panels from the tab box // * Loop thru the tab panels and check their index with the next selected tab's index Tab nextSelectedTab = null; for (Tab nextTab = (Tab)tab.getNextSibling(); nextTab != null; nextTab = (Tab)nextTab.getNextSibling()) if (!nextTab.isDisabled()) { nextSelectedTab = nextTab; break; } if (nextSelectedTab == null) { for (Tab nextTab = (Tab)tab.getPreviousSibling(); nextTab != null; nextTab = (Tab)nextTab .getPreviousSibling()) if (!nextTab.isDisabled()) { nextSelectedTab = nextTab; break; } } // we should alway have a next selected tab as we have the non-closeable Home Tab if (nextSelectedTab != null) { FWWindow win = null; int tabIndex = nextSelectedTab.getIndex(); Tabpanel nextSelectedTabPanel = null; Tabbox tabBox = nextSelectedTab.getTabbox(); Tabpanels tps = tabBox.getTabpanels(); List tpsChildren = tps.getChildren(); for (Object o : tpsChildren) { if (o instanceof Tabpanel) { Tabpanel tp = (Tabpanel)o; if (tp.getIndex() == tabIndex) { nextSelectedTabPanel = tp; break; } } } } } });
looks great~
thanks for sharing your code
My problem is this: i have a page with borderlayout with a combobox in the north.
When i select an option i load different tabbox in the south. How can i intercept blur of tab box in this case? My problem is that doesn't fire onSelect or onClose when i change tabbox from combo.
Workaround is work on change of combo, but if i can intercept blur of tab i can work only on tab object ...
thx
Asked: 2010-12-14 22:18:52 +0800
Seen: 490 times
Last updated: Jan 07 '13