SetPosition doesn't work with frame layout

27 views
Skip to first unread message

DogPlanner GSS

unread,
Jan 20, 2026, 3:03:46 AM (2 days ago) Jan 20
to DroidScript
Dear Developers,

We faced with following small problem - SetPosition doesn't work with frame layout option! We need to place small logo in the lower right corner of display but it doesn't work. 

Could you tell us pls what are we doing wrong?

E.g.

function OnStart() {
    
    start_lay = app.CreateLayout("Linear", "VCenter,FillXY");

    // Frame layout to hold layered images
    layFrm = app.CreateLayout("Frame");

    uix = app.CreateUIExtras();
    var theme = app.CreateTheme("Light");
    app.SetTheme( theme );

    // Create an image control using the uploaded image asset.
    img = app.CreateImage("Img/first_page_2.jpg", 1, 1); // Adjust width and aspect ratio as needed
    img.SetOnTouchUp( lay_OnTouch );
    layFrm.AddChild(img); // Add the image to the layout
  
    img_69logo = app.CreateImage("Img/gss69_logo.png", 0.2, 0.1); 
    img_69logo.SetPosition(0.4, 0.9); // Position relative to screen
    layFrm.AddChild(img_69logo);
                
    var txt = app.CreateText( "Нажмите на экран...", 0.7, -1, "bottom" );
    txt.SetTextSize( 22 );
    layFrm.AddChild(txt);
    
    start_lay.AddChild(layFrm);
    // Add the layout to the application.
    app.AddLayout(start_lay);
}

Thank you very much in advance.

Best regards
Dmitry

Alan Hendry

unread,
Jan 20, 2026, 4:38:50 AM (2 days ago) Jan 20
to DroidScript
HI,
I have an example that also says Fillxy on the layout
Not sure if you need to be a little bit away frim the corner
Regards, Alan H

const max = 5
const d = 0.25 // eye to plane
function OnStart() {
lay = app.CreateLayout("Absolute","FillXY")
app.AddLayout( lay )
for (let i = 0; i < max ; i++) {
  for (let j = 0; j < max ; j++) {
    for (let k = 0; k < max ; k++) {
       coord(i/max,j/max,k/max,k)
      } // k
    } // j
  }// i
} // onstart
function coord(x,y,z,k) {
// eye at 0,0,0
// x = left plane to point
// y = top plane to point
// z = front plane to point
    z = z + d
    var dz = d/z
    var l = x * dz
    var t = y * dz
    var w = 1/z/50
    var succ = k+1
    nm = "/Sys/Img/Explode"+succ+".png"
    var img = app.AddImage(lay,nm,w)
    img.SetPosition(l,t)
}

DogPlanner GSS

unread,
Jan 20, 2026, 4:06:16 PM (2 days ago) Jan 20
to DroidScript
Dear Alan,

Thank you very much for example! It is working. And even more interesting than a simple arrangement at the different points on the screen.

We will use it in our apps!

Thank you again. Have a nice day.

Best regards
Dmitry

вторник, 20 января 2026 г. в 12:38:50 UTC+3, hendr...@gmail.com:
Reply all
Reply to author
Forward
0 new messages