I’m currently trying to set a background image from a binding (the variably contains the path to the image).
I’m currently trying to set a background image from a binding (the variably contains the path to the image). I created a dummy binding and wrote the following code:
if($albumart!=null && $albumart!=””) item.setBoxBackground(LL.createImage($albumart),”nsf”,true);
But the background was updated only once. It doesn’t change anymore if the variable changes. What am I doing wrong?
]]>
< ![CDATA[
You have to set first this kind of instruction else you won’t have any refresh
var unused = $ll_minute;
It means your bindings will be refreshed /run every minute
]]>
< ![CDATA[
image = LL.createImage($albumart);
item.setBoxBackground(image,”n”,true);
return;
Works
]]>
< ![CDATA[
Bruno-Isa LAMOUR-ARNOULD the operation of loading an image is quite expensive. But I want to load the image instantly if it changes. So I would have to set a very short interval. That doesn’t sound like an acceptable solution.
username undefined this is the same as my script above, it works once, but doesn’t react to changes.
]]>
< ![CDATA[
I am working on a bug where a binding could become inactive when using the script Item.setBinding API. Could it be that somewhere in you setup you call this API ?
]]>
< ![CDATA[
Pierre Hébert no. But I think I found the problem: the path of the file didn’t change, only the content. I added another variable that indicates content change and returned that in the binding.
]]>
< ![CDATA[
Ok, that makes sense
]]>
< ![CDATA[
is it possible to do the same (update an image) for an icon via bindings? and which is more expensive, to update an image for box background or icon (assuming they are the same size)?
]]>
< ![CDATA[
Wern-Yuen Tan yes. I would assume that there is no relevant performance difference.
]]>
< ![CDATA[
Pierre Hébert on a sidenote: I also tried .setImage and it didn’t work at all.
]]>
< ![CDATA[
Lukas Morawietz which “property” binding field would one use to change the icon image? can’t seem to find it … i assume for box background we use the “box” field and just enter the script
]]>
< ![CDATA[
Wern-Yuen Tan I’d use dummy for both
]]>
< ![CDATA[
Lukas Morawietz thanks didn’t realize dummy could be used, never used that before. have been doing this via script triggered by Tasker
]]>