I am using a DeckPanel to simulate a sprite animation.
The images are runtime specified, so ImageBundles cant be used, and SetURL 
is too slow. Flicking over elements in a DeckPanel seems to result in a 
smooth animation, however, I am having trouble recieving clicks on the 
panel.

DeckPanel itself has no addHandler, so I put it in a FocusPanel.
In doing so I found MouseOver/Out work perfectly...but clickhandleing only 
works if its not animating. That is, if the currently shown widget does not 
change.

Panel1.setSize("100%","100%");
    RootLayoutPanel.get().add(Panel1);

    //a deckpanel in a focuspanel test  

    Image frame1=new Image("Image0.png");
    Image frame2=new Image("Image1.png");
    Image frame3=new Image("Image2.png");


    final DeckPanel deckpaneltest1 = new DeckPanel();
    deckpaneltest1.add(frame1);
    deckpaneltest1.add(frame2);
    deckpaneltest1.add(frame3);             

    //fix the size again, as deckpanel makes them 100%
    frame1.setSize("", "");
    frame2.setSize("", "");
    frame3.setSize("", "");

    deckpaneltest1.showWidget(0);


    FocusPanel containerPanel = new FocusPanel();   

    containerPanel.addClickHandler(new ClickHandler() {         
        @Override
        public void onClick(ClickEvent event) {
            //use a random number to see when this is updated
            TestLabel1.setText("click recieved."+"___"+Math.random());

        }
    });
    containerPanel.add(deckpaneltest1); 


    //timer
    Timer testanimation = new Timer(){
        @Override
        public void run() {

            int currentw = deckpaneltest1.getVisibleWidget();               
            currentw++;             
            if (currentw>=deckpaneltest1.getWidgetCount()){                 
                currentw = 0;                   
            }               

            deckpaneltest1.showWidget(currentw);
        }           
    };

    testanimation.scheduleRepeating(100);   

    Panel1.add(containerPanel);
    Panel1.add(TestLabel1);

My thinking all has something to do with the panel being "focused" which 
somehow prevents the normal click events from firing? Or maybe something to 
do with the default "focus" css I notice appear on the containerPanel when 
clicked. I am not even sure if this is expected behavior or a bug.

In either case, it has me somewhat stuck as to how to proceed.


-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to