1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    15
    Answers
    2
    Vote Rating
    0
    GlasgowKid is on a distinguished road

      0  

    Default Answered: Positioning an image with absolute x-y coordinates

    Answered: Positioning an image with absolute x-y coordinates


    Hello everyone,

    I'm new to Sencha Touch, and would like to redesign my existing Android App to work with Sencha Touch and Phongeap. I'd like to place a picture with absolute x-y coordinates oin the screen and make it draggable. Is there something like an absolute layout for Sencha Touch?

    Cheers,
    Glasgow

  2. You can use setPosition passing in the top and left value. It's not 100% like x/y but close

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,633
    Answers
    3452
    Vote Rating
    817
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You can use setPosition passing in the top and left value. It's not 100% like x/y but close
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Nov 2011
    Posts
    1
    Vote Rating
    0
    rahulrajput1189 is on a distinguished road

      0  

    Default Set X-Y position of any component

    Set X-Y position of any component


    Ext.getCmp('image').el.setX(10);
    Ext.getCmp('image').el.setY(10);

  5. #4
    Sencha User
    Join Date
    Jan 2012
    Posts
    15
    Answers
    2
    Vote Rating
    0
    GlasgowKid is on a distinguished road

      0  

    Default


    Thanks for the fast replies, but unfortunately I can't make it work and can't figure out why. It only places a div tag at position 100 100 instead of the image. My goal is to place multiple pics within my panel at absolute positions. I found this code on another thread, but don't know how to use it correctly.

    This is my complete source:

    Code:
    ...
    Cheers,
    Glasgow

    EDIT: Sorry everyone, I see that my example code was again ExtJs. I found in this thread how simple it is to place pics. I thought the id of the item is the same as the id tag within the <img>-html code. Here is the working code:
    Code:
    new Ext.Application({    launch: function() {
            new Ext.Panel({
                fullscreen: true,
                layout: 'fit',
                cls: 'hintergrund',
                items: [{xtype: 'panel', html: '<img src="http://dgrosche.charlottenthal.de/images/passbild.jpg">', id: 'imgPreview'}]
            });
            
            Ext.getCmp('imgPreview').setPosition(100, 100);
        }
    });
    Last edited by GlasgowKid; 17 Jan 2012 at 12:23 AM. Reason: Found solution on my own