Git Product home page Git Product logo

Comments (9)

dankurka avatar dankurka commented on July 20, 2024
Here is some testing code that shows the problem:
public void onModuleLoad() {
    final RootPanel root = RootPanel.get();
    FlexTable t = new FlexTable();
    root.add(t);
    ScrollPanel p = new ScrollPanel();
    p.setWidth("300px");
    p.setHeight("300px");
    root.add(p);
    p.add(t);
    t.setWidth("600px");
    t.setHeight("600px");
    t.setBorderWidth(10);
    t.setWidget(0,0,createLocationButton(p, "top left"));
    t.setWidget(0,1,createLocationButton(p, "top right"));
    t.setWidget(1,0,createLocationButton(p, "bottom left"));
    t.setWidget(1,1,createLocationButton(p, "bottom right"));
  }

  private Button createLocationButton(ScrollPanel p, String title) {
    final Button b = new Button(title);
    b.addClickListener(new ClickListener(){
      public void onClick(Widget sender) {
        Window.alert("Left:" + b.getAbsoluteLeft() + "\nTop:" +b.getAbsoluteTop() );
      }
    });
    return b;
  }
}

Reported by gwt.team.ecc on 2006-09-21 11:33:20

from gwt.

dankurka avatar dankurka commented on July 20, 2024

Reported by gwt.team.bruce on 2006-09-21 20:10:15

  • Labels added: Priority-High, Milestone-1_2_RC
  • Labels removed: Priority-Medium

from gwt.

dankurka avatar dankurka commented on July 20, 2024
Below is a more complete test. Fails for Opera.

  public void onModuleLoad() {
    final RootPanel root = RootPanel.get();
    root.add(new Label("check scroll offset"));
    FlexTable t = new FlexTable();
    root.add(t);
    ScrollPanel p = new ScrollPanel();
    p.setWidth("300px");
    p.setHeight("300px");
    root.add(p);
    p.add(t);
    t.setWidth("600px");
    t.setHeight("600px");
    t.setBorderWidth(10);
    t.setWidget(0,0,createLocationButton(p, "top left"));
    t.setWidget(0,1,createLocationButton(p, "top right"));
    t.setWidget(1,0,createLocationButton(p, "bottom left"));
    t.setWidget(1,1,createLocationButton(p, "bottom right"));
    root.add(new Label("Check border offset"));
    final FlowPanel flowPanel = new FlowPanel();
    root.add(flowPanel);
    flowPanel.setStyleName("my-BigBorder");
    flowPanel.setSize("409px", "195px");

    {
      final Button button = new Button();
      flowPanel.add(button);
      button.addClickListener(new ClickListener() {
        public void onClick(Widget e) {
           Window.alert("flowPanel location: " + flowPanel.getAbsoluteLeft() + ", "
            + flowPanel.getAbsoluteTop() + "\nbutton location: " +
button.getAbsoluteLeft() + ", "
            + button.getAbsoluteTop());
        }
      });
      button.setText("getLocation");
    }
  }


  private Button createLocationButton(ScrollPanel p, String title) {
    final Button b = new Button(title);
    b.addClickListener(new ClickListener(){
      public void onClick(Widget sender) {
        Window.alert("Left:" + b.getAbsoluteLeft() + "\nTop:" +b.getAbsoluteTop() );
      }
    });
    return b;
  }

Reported by gwt.team.ecc on 2006-09-25 12:04:30

from gwt.

dankurka avatar dankurka commented on July 20, 2024
#added absolutely possitions button to example above
  public void onModuleLoad() {
    final RootPanel root = RootPanel.get();
    root.add(new Label("______Scroll offset"));
    FlexTable t = new FlexTable();
    root.add(t);
    ScrollPanel p = new ScrollPanel();
    p.setWidth("300px");
    p.setHeight("300px");
    root.add(p);
    p.add(t);
    t.setWidth("600px");
    t.setHeight("600px");
    t.setBorderWidth(10);
    t.setWidget(0,0,createLocationButton("top left"));
    t.setWidget(0,1,createLocationButton("top right"));
    t.setWidget(1,0,createLocationButton("bottom left"));
    t.setWidget(1,1,createLocationButton("bottom right"));
    root.add(new Label("Check border offset"));
    final FlowPanel flowPanel = new FlowPanel();
    root.add(flowPanel);
    flowPanel.setStyleName("my-BigBorder");
    flowPanel.setSize("409px", "195px");

    {
      final Button button = new Button();
      flowPanel.add(button);
      button.addClickListener(new ClickListener() {
        public void onClick(Widget e) {
           Window.alert("flowPanel location: " + flowPanel.getAbsoluteLeft() + ", "
            + flowPanel.getAbsoluteTop() + "\nbutton location: " +
button.getAbsoluteLeft() + ", "
            + button.getAbsoluteTop());
        }
      });
      button.setText("getLocation");
    }

    Button absolute= createLocationButton("absolute");
    root.add(absolute, 10,10);
  }


  private Button createLocationButton(String title) {
    final Button b = new Button(title);
    b.addClickListener(new ClickListener(){
      public void onClick(Widget sender) {
        Window.alert("Left:" + b.getAbsoluteLeft() + "\nTop:" +b.getAbsoluteTop() );
      }
    });
    return b;
  }

Reported by gwt.team.ecc on 2006-09-26 11:55:05

from gwt.

dankurka avatar dankurka commented on July 20, 2024
Fixed on Mozilla by manually crawling through parents and looking for scroll panels.

Reported by gwt.team.ecc on 2006-09-26 18:33:10

  • Status changed: FixedNotReleased

from gwt.

dankurka avatar dankurka commented on July 20, 2024
Related discussion:
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/c908d345afb514f1/

Reported by gwt.team.vli on 2006-09-27 17:15:01

from gwt.

dankurka avatar dankurka commented on July 20, 2024

Reported by gwt.team.jgw on 2006-10-31 16:59:58

  • Status changed: Fixed

from gwt.

dankurka avatar dankurka commented on July 20, 2024

Reported by [email protected] on 2008-05-02 02:32:22

from gwt.

dankurka avatar dankurka commented on July 20, 2024

Reported by [email protected] on 2011-02-09 00:10:59

  • Labels added: Milestone-1_2-RC
  • Labels removed: Milestone-1_2_RC

from gwt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.