"Other" new variant problem

agraham

Expert
Licensed User
Longtime User
I've not really got my head around what "scale" does but I have a tablet that reports its GetDeviceLayoutValues as 480 x 800 Scale 1 so I am trying to make a custom layout for it. The app has the four "standard" layouts defined as well as the custom ones for the tablet. When run B4A correctly chooses the right layout but the control positions are wrong. The layouts were done on the emulator and I note that the control position values both in the designer and in the app on the device are not what I would expect but are those of a 320 x 480 screen.

I can't check what would happen with the Designer running on the tablet as it doesn't work over wireless (in joke of a sort!)

It would be nice if the designer indicated what device it was presently connected to. I've got three going at the moment.
 

agraham

Expert
Licensed User
Longtime User
Scale = DPI / 160.
Yeah, I go that. It's what the Designer and the runtime do with it for different screen sizes that I haven't got worked out..

Try to create a single variant and see if it behaves properly.
Just the same. It looks like the Designer or the runtime is not scaling up the co-ordinates to suit the screen size. It's also not scaling the control size, but I'm not sure whether you intend that or not. I assume not as the scale is 1 so the controls ought to stay the same physical size.
 

agraham

Expert
Licensed User
Longtime User
I suspect I was puzzled by Scale because I was expecting it to be more complicated than it actually is and do all sorts of clever adjustments to make things fit on different size screens.

In fact looks as though at layout time, having selected the layout file that best matches the device the Top, Left, Width and Height for each control are multiplied by a factor that seems to be StoredLayoutScale/ActualDeviceScale. Is this correct?

EDIT :- Or more likely ActualDeviceScale/StoredLayoutScale which better matches what I see happening.
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
Yes.

The variants themselves allow you to (pretty) easily create multiple layouts for multiple screens.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…