Hi everybody,
I would like to suggest the inclusion of a new feature in B4A, which is to make possible the automatic scaling of a layout (bal) maintaining the aspect ratio of both the positions and the sizes of the views that were used in the Abstract Designer. Often what you want is simply to make all the views grow in proportion to the screen size. Today’s procedures to accomplish that are very cumbersome.
AutoScale / AutoScaleAll command in Designer is useful, but it is NOT a solution when we want to show, in real devices, the exact proportions of the views that were generated in Abstract Designer.
Yes, I've read some other posts about AutoScaleAll. There were comments saying that this command is not for this purpose. Precisely for this reason I am suggesting the inclusion of a specific feature for this, which could be a new command, perhaps called PercentageScaleAll or DeviceScaleAll, something like that.
Yes, I also read posts saying that big screens should be exploited better, so that an option like this one I am proposing wouldn’t be needed. I can’t agree with that, because often (very frequently) I faced situations when a feature like this was necessary.
Currently, to achieve a perfect scaling of all the views, according to the real size of the device screen where the app is running, the developer has to calculate the proportions of all the dimensions and positions of EACH component relative to the size of the screen.
This also requires a LOT of lines of script code in the Designer, such as:
To better understand the problem, I added two projects. Both of them contains a layout with two variants, one for landscape and one for portrait.
The first one, _Test_AutoScale.zip just use the tradicional "AutoscaleAll" command in the script.
The second one, _Test_PercentScale.zip tries to accomplish the result we are wishing, but it demanded a lot of work. Notice that it was necessary to include several lines of script code in the specific area of each variant to achieve, in all simulated devices of the UI Cloud, an appearance similar to that shown in Abstract Designer. The results can be seen in "B4A UI Cloud-Script-percent-scaled.pdf" file.
On the other hand, the file "B4A UI Cloud-Without-AutoScaleAll.pdf" shows the screens of the devices simulated in the UI Cloud when not using script code in Designer. Also, "B4A UI Cloud-AutoScaleAll.pdf" file shows the appearance of the UI Cloud simulated devices when using AutoScaleAll. Notice that none of these solutions reach the goal of making the views fit to the screens in the exact proportion to their sizes and positions as in the Abstract Designer.
It would be nice to achieve the same results as those obtained with the scripts in the _Test_PercentScale project using just one command, since all calculations can be automated.
So the proposal or “The Wish” is [EDITED-april-05-2015]:
- Add a new command in Designer (perhaps PercentageScaleAll or DeviceScaleAll) which, when applied, automatically calculate the sizes and positions of each view relative to the screen size of the Abstract Designer and, at runtime, apply these proportions according to the actual size of the device screen being used.
OR
- Change the behavior of AutoScaleAll when using AutoScaleRate(1), so that it gives us, at runtime, an EXACTLY match of the UI layouts built in Designer, for any device (it is ALMOST there, as we can see in the Comparison.pdf below)
Notice that a feature like the one here proposed is not a problem for those who want to make a different use of big screens: they can create a specific variant for that purpose and simply make no use of such a command.
This wish aims to facilitate the developer's life, eliminating the need to make calculations and avoiding the inclusion of a large number of script command lines in the Designer.
I would like to suggest the inclusion of a new feature in B4A, which is to make possible the automatic scaling of a layout (bal) maintaining the aspect ratio of both the positions and the sizes of the views that were used in the Abstract Designer. Often what you want is simply to make all the views grow in proportion to the screen size. Today’s procedures to accomplish that are very cumbersome.
AutoScale / AutoScaleAll command in Designer is useful, but it is NOT a solution when we want to show, in real devices, the exact proportions of the views that were generated in Abstract Designer.
Yes, I've read some other posts about AutoScaleAll. There were comments saying that this command is not for this purpose. Precisely for this reason I am suggesting the inclusion of a specific feature for this, which could be a new command, perhaps called PercentageScaleAll or DeviceScaleAll, something like that.
Yes, I also read posts saying that big screens should be exploited better, so that an option like this one I am proposing wouldn’t be needed. I can’t agree with that, because often (very frequently) I faced situations when a feature like this was necessary.
Currently, to achieve a perfect scaling of all the views, according to the real size of the device screen where the app is running, the developer has to calculate the proportions of all the dimensions and positions of EACH component relative to the size of the screen.
This also requires a LOT of lines of script code in the Designer, such as:
'Variant specific script: 320x480,scale=1
Button1.Height = 9.30%y '100 * 40/430 <<-- 430 if there IS a title and NOT fullscreen
Button1.Width = 31.25%x '100 * 100/320
Button1.Top = 50%y - 9.30%y/2
Button1.Left = 50%x - 31.25%x/2
Label1.left = 7.5%x '100 * 24/320
Label1.Top = 5.58%y '100 * 24/430 <<-- 430 if there IS a title and NOT fullscreen
Label1.Width = 31.25%x '100 * 100/320
Label1.Height = 9.30%y '100 * 40/430 <<-- 430 if there IS a title and NOT fullscreen
Button1.Height = 9.30%y '100 * 40/430 <<-- 430 if there IS a title and NOT fullscreen
Button1.Width = 31.25%x '100 * 100/320
Button1.Top = 50%y - 9.30%y/2
Button1.Left = 50%x - 31.25%x/2
Label1.left = 7.5%x '100 * 24/320
Label1.Top = 5.58%y '100 * 24/430 <<-- 430 if there IS a title and NOT fullscreen
Label1.Width = 31.25%x '100 * 100/320
Label1.Height = 9.30%y '100 * 40/430 <<-- 430 if there IS a title and NOT fullscreen
To better understand the problem, I added two projects. Both of them contains a layout with two variants, one for landscape and one for portrait.
The first one, _Test_AutoScale.zip just use the tradicional "AutoscaleAll" command in the script.
The second one, _Test_PercentScale.zip tries to accomplish the result we are wishing, but it demanded a lot of work. Notice that it was necessary to include several lines of script code in the specific area of each variant to achieve, in all simulated devices of the UI Cloud, an appearance similar to that shown in Abstract Designer. The results can be seen in "B4A UI Cloud-Script-percent-scaled.pdf" file.
On the other hand, the file "B4A UI Cloud-Without-AutoScaleAll.pdf" shows the screens of the devices simulated in the UI Cloud when not using script code in Designer. Also, "B4A UI Cloud-AutoScaleAll.pdf" file shows the appearance of the UI Cloud simulated devices when using AutoScaleAll. Notice that none of these solutions reach the goal of making the views fit to the screens in the exact proportion to their sizes and positions as in the Abstract Designer.
It would be nice to achieve the same results as those obtained with the scripts in the _Test_PercentScale project using just one command, since all calculations can be automated.
So the proposal or “The Wish” is [EDITED-april-05-2015]:
- Add a new command in Designer (perhaps PercentageScaleAll or DeviceScaleAll) which, when applied, automatically calculate the sizes and positions of each view relative to the screen size of the Abstract Designer and, at runtime, apply these proportions according to the actual size of the device screen being used.
OR
- Change the behavior of AutoScaleAll when using AutoScaleRate(1), so that it gives us, at runtime, an EXACTLY match of the UI layouts built in Designer, for any device (it is ALMOST there, as we can see in the Comparison.pdf below)
Notice that a feature like the one here proposed is not a problem for those who want to make a different use of big screens: they can create a specific variant for that purpose and simply make no use of such a command.
This wish aims to facilitate the developer's life, eliminating the need to make calculations and avoiding the inclusion of a large number of script command lines in the Designer.
Attachments
Last edited: