designer scripts - how to ...

Aysic4Bandroid

Member
Licensed User
Longtime User
hi,
Please can anyone put be right here - i want to load a different background image in a panel which is set 100% wide and high. I'm testing on three specific devices:
3.5 inch phone, and
7 and 10.1 inch tablets
and landscape and portrait variations for each

How can i achieve this with the designer scripts feature (i'm currently getting an error when trying to run this code in the variant-specific script block for my 7", landscape variant:

B4X:
'Variant specific script: 800x480,scale=1
pnlBackdrop.SetBackgroundImage(LoadBitmap(File.DirAssets,"appbg_L7.png"))

The error reads:
B4X:
Compiling code.                         0.01
Compiling layouts code.                 Error
The given key was not present in the dictionary.
Error File: kwzmka_main.bal

Go to the designer script page to debug this error.


Have i misunderstood the scope of what can be achieved in the designer scripts tab - if i do it in the editor with conditional statements is this the correct way?

Many Thanks
 

NJDude

Expert
Licensed User
Longtime User
You CANNOT do this on the designer scripts:
B4X:
pnlBackdrop.SetBackgroundImage(LoadBitmap(File.DirAssets,"appbg_L7.png"))

You will have to do that on the activity

You could use a code like THIS to achieve what you're looking for.
 
Last edited:
Upvote 0
Top