Hello:
  I have a similar situation to @nyankov in that I need to have some
areas in my panel remain fixed while others scroll. However, the
difference is that I am doing all of the activity in a GWT
application. Using a combination of posts above, I was able to get the
application working so that the bottom button panels remain fixed when
the window was resized or scrolled. However, I too, saw the flickering
and jumping that was mentioned but couldn't determine from the
previous posts if you were able to solve that issue ...
   In addition to a fixed bottom panel, I have a fixed top panel, too.
However, that isn't working at all and I have a good feeling that my
parameter for setStyleAttribute is off. My code follows ...  Thanks
for your help
[code]

import com.google.gwt.event.logical.shared.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.Window.ScrollEvent;
import com.google.gwt.user.client.Window.ScrollHandler;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;

public class TestScrollBar {



    public static void createTestScrollBar () {
        RootPanel rootPanel = RootPanel.get();

       //create absolute panel for project information
       final AbsolutePanel absolutePanel = new AbsolutePanel();
       HorizontalPanel projectPanel = new HorizontalPanel();
       Label projectLabel = new Label("Project Name:");

       TextBox projectText = new TextBox();
       projectPanel.add(projectLabel);
       projectPanel.add(projectText);

       absolutePanel.add(projectPanel);
       absolutePanel.setSize("100%","50px");

      //test scrolling idea with labels
      VerticalPanel mainPanel = new VerticalPanel();
      mainPanel.add(new Label(" Scroll Test"));
      mainPanel.add(new Label("Scroll Test2"));
      mainPanel.add(new Label("Scroll Test3"));
      mainPanel.add(new Label("Scroll Test4"));
      mainPanel.add(new Label("Scroll Test5"));
      mainPanel.add(new Label("Scroll Test6"));
      mainPanel.add(new Label("Scroll Test7"));
      mainPanel.add(new Label("Scroll Test8"));
      mainPanel.add(new Label("Scroll Test9"));
      mainPanel.add(new Label("Scroll Test10"));
      mainPanel.add(new Label("Scroll Test12"));
      mainPanel.add(new Label("Scroll Test12"));

      //create scrollPanel
      ScrollPanel scrollPanel = new ScrollPanel();
      scrollPanel.add(mainPanel);
      scrollPanel.setSize("100%", "100%");

      //create buttonPanel
      final AbsolutePanel cancelSavePanel = new AbsolutePanel();
      Button saveButton = new Button("Save");
      Button cancelButton = new Button("Cancel");
      saveButton.setSize("100px", "25px");
      cancelButton.setSize("100px", "25px");
      cancelSavePanel.add(saveButton);
      cancelSavePanel.add(cancelButton);
      cancelSavePanel.setSize("100%","25px");

      //add panels to rootPanel
      rootPanel.add(absolutePanel);
      rootPanel.add(scrollPanel);
      rootPanel.add(cancelSavePanel, 0, Window.getClientHeight()-25 );

      //window resize handler
      Window.addResizeHandler(new ResizeHandler() {
           public void onResize(ResizeEvent event) {
                    com.google.gwt.user.client.Element h =
absolutePanel.getElement();
                    //DOM.setStyleAttribute(h, "top", (event.getHeight
()-51)+"px");
                    DOM.setStyleAttribute(h, "top", "0px");

                    com.google.gwt.user.client.Element k =
cancelSavePanel.getElement();
                    DOM.setStyleAttribute(k, "top", (event.getHeight
()-25)+"px");
             }
       });

      //window scroll handler
      Window.addWindowScrollHandler(new ScrollHandler() {
             public void onWindowScroll(ScrollEvent event) {
                    com.google.gwt.user.client.Element h =
absolutePanel.getElement();
                     DOM.setStyleAttribute(h, "top", "0px");

                     com.google.gwt.user.client.Element k =
cancelSavePanel.getElement();
                     DOM.setStyleAttribute(k, "top",
(Window.getClientHeight()
                            +event.getScrollTop()-25)+"px");
             }
     });

    }

}

[/code]
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to