Problem in setimage

148 views
Skip to first unread message

Alan Hendry

unread,
May 30, 2023, 2:51:23 PM5/30/23
to DroidScript
HI,
Getting error - cannot read properties of null  (reading setimage)
Regards, ah
    i4 = app.AddImage(lay2,"ds:/Sys/Img/Pillar.png")
    i4.SetImage( "ds:/Sys/Img/Pillar.png")

Right2TheV0id

unread,
May 31, 2023, 3:08:21 PM5/31/23
to DroidScript
This is because the "ds:" scheme is for HTML elements, as the doc says:
Support for ds:/* style paths in HTML elements (eg. ds:/Sys/app.js).

Removing "ds:" seems to fix your issue.

Alan Hendry

unread,
May 31, 2023, 5:27:09 PM5/31/23
to DroidScript
HI,
Whoops copied it from elsewhere.
The original aim was to try and load an image from the web.
That gives me the error.
I tried to app.Uri2Path, and that failed too.
Regards, ah

Steve Garman

unread,
Jun 1, 2023, 2:55:07 AM6/1/23
to DroidScript
I get confused enough about what paths work where that  I now keep in my pastebin a function checkPath to see if the lath I'm using is valid

I suspect this may not be guaranteed to work in future versions but in the past I've caught all sorts of stupid mistakes with it

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

   txt = app.AddText(lay,"?", null, null, "Left,Multiline")

   //Add layout to app.
   app.AddLayout(lay)
   path1 = checkPath("ds:/Sys/Img/Pillar.png")
   path2 = checkPath("/Sys/Img/Pillar.png")

   txt.SetText(path1+"\n\n\n"+path2)

}

function checkPath(path) {
   var sep = "\n------\n"
   var rp = app.RealPath(path)
   var exst = app.FileExists( rp )?"exists":"does not exist"
   var ret = path + sep + rp + sep + exst
return(ret)
}

Alan Hendry

unread,
Jun 4, 2023, 12:04:56 PM6/4/23
to DroidScript
HI,
Is it possible to use a web URL in a DS Image?
and Uri2Path
Currently working around it by opening a webview, I'd like to get the proportions correct.
Regards, ah

Cemal

unread,
Jun 27, 2023, 4:05:38 AM6/27/23
to DroidScript
Hi,

To show a picture on the internet, I think it can be done with the SetData parameter of the Image object by taking the picture with fetch in JS and converting it to arrayBuffer.

Probably a better idea to download from DroidStore but I couldn't get to the page right now.

Alan Hendry

unread,
Jun 27, 2023, 9:51:45 AM6/27/23
to DroidScript
HI,
I get message 
This phone isn't compatible with this app.
Regards, ah

Cemal

unread,
Jun 27, 2023, 10:25:01 AM6/27/23
to DroidScript
You can find it by searching for Picasso on the DroidStore (https://ds.justplayer.de/).
Reply all
Reply to author
Forward
0 new messages