Results 1 to 2 of 2

Thread: How to use alignTo method from Window component

  1. #1
    Sencha Premium User
    Join Date
    Feb 2014

    Question How to use alignTo method from Window component

    Hi I want to know how exactly to use alignTo method in Window component. Here is the alignTo code :

       * Aligns the window to the specified element. Should only be called when the window is visible.
       * @param elem      the element to align to.
       * @param alignment the position to align to (see {@link XElement#alignTo} for more details)
       * @param offsetX   X offset
       * @param offsetY   Y offset
      public void alignTo(Element elem, AnchorAlignment alignment, int offsetX, int offsetY) {
        Point p = getElement().getAlignToXY(elem, alignment, offsetX, offsetY);
        setPagePosition(p.getX(), p.getY());
    I usually do something like this when I want to use it :

    AnchorAlignment anchorAlignment = new AnchorAlignment(Anchor.TOP_LEFT, Anchor.TOP_LEFT, false);
    loadDataDialog.alignTo(topToolbar.getElement(), anchorAlignment, 1, 46);
    But what I really confused is to determine the AnchorAlignment parameter, the align and targetAlign parameter which is a Anchor type. I usually need to try it first what the combination that fit my needs. Unfortunately there are no documentation for this type. Is there any better way to learn to adjust that parameters beside try to run it first (kinda painful when I need to try a lot combination before I found the correct one).

    Thanks and regards.

  2. #2
    Sencha Sr Product Manager
    Join Date
    Jan 2012
    Arlington, WA


    I know what you mean. That's on the agenda to improve. The only method at the moment is to mess with the options. But what I do is search the api for it and copy what we've done before.

    If you consider the target element in the anchor, it's the point where you're targeting to align to. That should help delineate the other alignment the element your moving. Then it's a matter of which point you want to align to.

    I'm using it here in this example:

    Not sure that helps, but thanks for reporting.


Similar Threads

  1. Replies: 3
    Last Post: 26 Oct 2012, 6:20 PM
  2. Replies: 1
    Last Post: 9 Feb 2012, 1:47 PM
  3. Replies: 0
    Last Post: 14 Apr 2011, 6:38 AM
  4. [CLOSED] Bug: Window.alignTo()
    By Cypher in forum Ext GWT: Bugs (1.x)
    Replies: 2
    Last Post: 19 Aug 2008, 5:01 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts