Thursday, December 29, 2011

Re: TabLayoutPanel SelectionHandler invoked multiple times

That was exactly the problem.
I had put it inside a function which was invoked every time a tab is
created. Due to this, selection handler was getting added multiple
times.I moved it to the constructor and now it is invoked just once.
Thanks a lot for the guidance.
On Dec 29, 7:25 am, Patrick Tucker <tucker...@gmail.com> wrote:
> That Is how you added the handler, I'm wondering where.  If you are
> adding it in the constructor, onLoad(), ...
>
> If you are adding it in onLoad or some function that is calledmultipletime, that will explain why it is firingmultipletimes.  Add
> a print statement before the add and check the output.
>
> On Dec 28, 1:08 am, ALB-PSP-DV1 <albpsp...@gmail.com> wrote:
>
>
>
>
>
>
>
> > I'm adding the selection handler to theTabLayoutPanel.
>
> > fareDisplayPanel.addSelectionHandler(newSelectionHandler<Integer>()
> > { }
>
> > On Dec 28, 8:56 am, Patrick Tucker <tucker...@gmail.com> wrote:
>
> > > Where are you adding theSelectionHandler?
>
> > > On Dec 27, 7:47 am, ALB-PSP-DV1 <albpsp...@gmail.com> wrote:
>
> > > > Hi,
>
> > > > I have aTabLayoutPanel with 3 tabs. I have added a selection handler
> > > > to it to change the color of the selected/unselected tabs.
>
> > > > However theselectionHandlerseems to beinvoked3timesinstead of
> > > > once when I select a tab.
>
> > > > i.e.SelectionHandlerinvocation = Total number of tabs in
> > > >TabLayoutPanel
>
> > > > @UiField
> > > >TabLayoutPanelfareDisplayPanel;
>
> > > > fareDisplayPanel.addSelectionHandler(newSelectionHandler<Integer>() {
> > > >           @Override
> > > >           public void onSelection(final SelectionEvent<Integer> event)
> > > >           {
> > > >             ---------- code for styling selected/unselected
> > > > tabs----------
> > > >           }
>
> > > > });
>
> > > > Can someone please point out the mistake that I'm doing. Thanks in
> > > > advance.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment