margret Well-Known Member Licensed User Longtime User Mar 12, 2014 #1 I have a layout with AutoScale code. The code is the exact same in both images except for an If Condition, yet the two yield completely different results. Anyone know why? You can see the layout size and the script code in each condition. They should both be the same.
I have a layout with AutoScale code. The code is the exact same in both images except for an If Condition, yet the two yield completely different results. Anyone know why? You can see the layout size and the script code in each condition. They should both be the same.
M Mahares Expert Licensed User Longtime User Mar 13, 2014 #2 My understanding is that you should always use dips or % in the designer script, except if you are dealing with text size. I do not know if using dips for the panel width here will solve your issue. Upvote 0
My understanding is that you should always use dips or % in the designer script, except if you are dealing with text size. I do not know if using dips for the panel width here will solve your issue.
margret Well-Known Member Licensed User Longtime User Mar 13, 2014 #3 I am not setting it, I am forcing it through the If block. This code is the same with or without the If condition because the PanelMain1 is 1024. The point is,why should it yield a different result because of the If Condition? Upvote 0
I am not setting it, I am forcing it through the If block. This code is the same with or without the If condition because the PanelMain1 is 1024. The point is,why should it yield a different result because of the If Condition?
Beja Expert Licensed User Longtime User Mar 13, 2014 #4 Hi Margret, The tiny value of -0.001 in my opinion, relates to the tiny change in the scale that's barley noticeable. That logically suggests that the condition is being processed and executed! but this is impossible since the condition lines are commented out. so... to my two cents.. The microprocessor of your computer is too lazy it is reusing previously calculated value, when the project first run before the condition was commented, and I would suggest you clean up the cache and collect I don't know what. Upvote 0
Hi Margret, The tiny value of -0.001 in my opinion, relates to the tiny change in the scale that's barley noticeable. That logically suggests that the condition is being processed and executed! but this is impossible since the condition lines are commented out. so... to my two cents.. The microprocessor of your computer is too lazy it is reusing previously calculated value, when the project first run before the condition was commented, and I would suggest you clean up the cache and collect I don't know what.
margret Well-Known Member Licensed User Longtime User Mar 13, 2014 #5 The script code is listed under each layout that is displayed. I am not running any app, this is displayed on the device in the designer and the only thing that is running is the script. The line you pointed out is never used, it is commented out in both cases. You can see the uncommented script code for each one in each image. Upvote 0
The script code is listed under each layout that is displayed. I am not running any app, this is displayed on the device in the designer and the only thing that is running is the script. The line you pointed out is never used, it is commented out in both cases. You can see the uncommented script code for each one in each image.
Beja Expert Licensed User Longtime User Mar 13, 2014 #6 Alright.. According to my experience with the layout.. one must save the layout each time a new view is added. Try to save the layout using "Save As..." NOT "Save", and then give it, of course the same name and replace... etc. May be some of recently added views are not AutoScalling because simply are not saved. just give it a try Upvote 0
Alright.. According to my experience with the layout.. one must save the layout each time a new view is added. Try to save the layout using "Save As..." NOT "Save", and then give it, of course the same name and replace... etc. May be some of recently added views are not AutoScalling because simply are not saved. just give it a try
Erel B4X founder Staff member Licensed User Longtime User Mar 13, 2014 #7 Can you upload the layout file? Mahares is correct. You are missing dip units in the if condition. Upvote 0
margret Well-Known Member Licensed User Longtime User Mar 13, 2014 #8 Here is a test layout. In the designer the script yields two different results, depending if the IF - End If block is used or not. That block commented or un-commented should give the same result. Attachments LayoutIssue.zip LayoutIssue.zip 1.6 KB · Views: 387 Upvote 0
Here is a test layout. In the designer the script yields two different results, depending if the IF - End If block is used or not. That block commented or un-commented should give the same result.
M Mahares Expert Licensed User Longtime User Mar 13, 2014 #9 Since your layout is variant specific, I do not think you should use: AutoScaleAll in the Designer Script, at least I never did. In fact if you comment AutoScaleAll, the layout is the same whether the If-End if block is commented or not. Upvote 0
Since your layout is variant specific, I do not think you should use: AutoScaleAll in the Designer Script, at least I never did. In fact if you comment AutoScaleAll, the layout is the same whether the If-End if block is commented or not.
margret Well-Known Member Licensed User Longtime User Mar 13, 2014 #10 This is a sample for something I wll be working on. Until I get it working, I can not continue. It's just that the layout should be the same with or without the IF block. I am using B4A 3.0. Version 3.5 will not show the script change by pressing F5. Upvote 0
This is a sample for something I wll be working on. Until I get it working, I can not continue. It's just that the layout should be the same with or without the IF block. I am using B4A 3.0. Version 3.5 will not show the script change by pressing F5.
klaus Expert Licensed User Longtime User Mar 13, 2014 #11 I tested your layout file with B4A versions 3.20 and 3.50. I don't see any defference in the Abstract Designer with or without the If statement. Two things look strange to me: - the width of Enotesee2 is wider than the screen width, why. - AutoScaleRate(-.0.065) looks very strange to me, what do you expect with this value ? According to the equations of AutoScale, a value of AutoScaleRate = -.0.065 will have almost no effect on the layout. I really don't understand what you excpect with this value. As Mahares already pointed out, why do you use AutoScaleAll in a specific layout. This is a sample for something I will be working on. Click to expand... Can you be more precise on what you want to do and what you expect. Upvote 0
I tested your layout file with B4A versions 3.20 and 3.50. I don't see any defference in the Abstract Designer with or without the If statement. Two things look strange to me: - the width of Enotesee2 is wider than the screen width, why. - AutoScaleRate(-.0.065) looks very strange to me, what do you expect with this value ? According to the equations of AutoScale, a value of AutoScaleRate = -.0.065 will have almost no effect on the layout. I really don't understand what you excpect with this value. As Mahares already pointed out, why do you use AutoScaleAll in a specific layout. This is a sample for something I will be working on. Click to expand... Can you be more precise on what you want to do and what you expect.
margret Well-Known Member Licensed User Longtime User Mar 13, 2014 #12 My goal is to design one variant in landscape for a selected device, it is 1024 x 800 - scale = 1. I then would like to scale that variant up or down, in code/script to fit the screen of other devices that may be 800 x 600, 1980 x 1200, etc. The layout is not conducive to anchor points as there are many views off center, both vertically and horizontally. As I have said, the layout and any code I have posted here are samples and for testing purposes. Also, you will not see any difference with 3.2 or 3.5, as it will not run the script by pressing F5, 3.0 will run the script. Erel said, if the layout matches the device the script will not run(in newer version). But I find it will not run at all even if you are close. I have changed the layout by a couple of hundred dpi and it still will not run the script. There are others with more knowledge than I, that have tested this and found the same results I did. You can force the newer version to show this by adding this code and see the difference at runtime, but they can not been seen by just running the script in the designer(pressing F5). Code: Copy Dim jo As JavaObject jo.InitializeStatic("java.lang.System").RunMethod("setProperty", Array As Object("autoscaleall_old_behaviour", "true")) Upvote 0
My goal is to design one variant in landscape for a selected device, it is 1024 x 800 - scale = 1. I then would like to scale that variant up or down, in code/script to fit the screen of other devices that may be 800 x 600, 1980 x 1200, etc. The layout is not conducive to anchor points as there are many views off center, both vertically and horizontally. As I have said, the layout and any code I have posted here are samples and for testing purposes. Also, you will not see any difference with 3.2 or 3.5, as it will not run the script by pressing F5, 3.0 will run the script. Erel said, if the layout matches the device the script will not run(in newer version). But I find it will not run at all even if you are close. I have changed the layout by a couple of hundred dpi and it still will not run the script. There are others with more knowledge than I, that have tested this and found the same results I did. You can force the newer version to show this by adding this code and see the difference at runtime, but they can not been seen by just running the script in the designer(pressing F5). Code: Copy Dim jo As JavaObject jo.InitializeStatic("java.lang.System").RunMethod("setProperty", Array As Object("autoscaleall_old_behaviour", "true"))
margret Well-Known Member Licensed User Longtime User Mar 13, 2014 #13 Let's see if this helps. Image "st1.png" is the layout loaded in the designer and displayed on the device with no script. Screen shots taken with B4A. Image "st2.png" is the same but with this script running: Code: Copy 'Variant specific script: 960x544,scale=1 amt = -.0650 'If PanelMain.Width > 700dip Then AutoScaleRate(amt) AutoScaleAll 'End If Image "st3.png" is the same but with this script running: Code: Copy 'Variant specific script: 960x544,scale=1 amt = -.0650 If PanelMain.Width > 700dip Then AutoScaleRate(amt) AutoScaleAll End If Attachments st1.png 32.5 KB · Views: 529 st2.png 36.7 KB · Views: 455 st3.png 33.7 KB · Views: 496 Upvote 0
Let's see if this helps. Image "st1.png" is the layout loaded in the designer and displayed on the device with no script. Screen shots taken with B4A. Image "st2.png" is the same but with this script running: Code: Copy 'Variant specific script: 960x544,scale=1 amt = -.0650 'If PanelMain.Width > 700dip Then AutoScaleRate(amt) AutoScaleAll 'End If Image "st3.png" is the same but with this script running: Code: Copy 'Variant specific script: 960x544,scale=1 amt = -.0650 If PanelMain.Width > 700dip Then AutoScaleRate(amt) AutoScaleAll End If
stevel05 Expert Licensed User Longtime User Mar 13, 2014 #14 I've tried it on V3.0 and can see the issue. It's even stranger if you make a change. I tried moving BNCan.Top just to make sure it was running the code in the If block and the layout changes again. Code: Copy amt = -.0650 If PanelMain.Width > 700dipThen 'BNCan.Top = 0 AutoScaleRate(amt) AutoScaleAll EndIf Try running it, then un-commenting the BNCan.Top line. Upvote 0
I've tried it on V3.0 and can see the issue. It's even stranger if you make a change. I tried moving BNCan.Top just to make sure it was running the code in the If block and the layout changes again. Code: Copy amt = -.0650 If PanelMain.Width > 700dipThen 'BNCan.Top = 0 AutoScaleRate(amt) AutoScaleAll EndIf Try running it, then un-commenting the BNCan.Top line.
Erel B4X founder Staff member Licensed User Longtime User Mar 14, 2014 #15 I'm not sure whether it is related or not however the scale rate should be a value between 0 to 1 (usually smaller than 0.5). Upvote 0
I'm not sure whether it is related or not however the scale rate should be a value between 0 to 1 (usually smaller than 0.5).
margret Well-Known Member Licensed User Longtime User Mar 14, 2014 #16 @Erel This is the layout you had ask me to post. It's attached to Post # 8. I have tried it, it doesn't matter the scale rate. I have tried .5, .3, etc. It still yields different results if the IF - End If block is used and there should be no difference. Upvote 0
@Erel This is the layout you had ask me to post. It's attached to Post # 8. I have tried it, it doesn't matter the scale rate. I have tried .5, .3, etc. It still yields different results if the IF - End If block is used and there should be no difference.
margret Well-Known Member Licensed User Longtime User Mar 15, 2014 #17 @Erel Any more info or testing on this issue? Did you test the layout attached to post # 8? I really would like to find the cause. Upvote 0
@Erel Any more info or testing on this issue? Did you test the layout attached to post # 8? I really would like to find the cause.
Erel B4X founder Staff member Licensed User Longtime User Mar 16, 2014 #18 I'm unable to reproduce it. I'm commenting the if / end if lines and run the script and see no changes. What are the exact steps to reproduce it? Upvote 0
I'm unable to reproduce it. I'm commenting the if / end if lines and run the script and see no changes. What are the exact steps to reproduce it?