Pflichtfeld Active Member Licensed User Apr 5, 2020 #1 Read a lot of dpi and dip, but am still confused: In designer, I set lbltitle.height to 30 I can in Activity_Create set the lbltitle.height and log all that: B4X: Copy Log(LblTitle.Height) LblTitle.Height=30dip Log(LblTitle.Height) LblTitle.Height=30 Log(LblTitle.Height) Dim ii As Int=30 LblTitle.Height=ii Log(LblTitle.Height) 'LblTitle.Height=ii dip 'of course does not work. which gives me the values: 98 90 30 30 1. Why is the height-log first 98 and then 90? should it not be the same? 2. How can I set a dip-value with a variable.
Read a lot of dpi and dip, but am still confused: In designer, I set lbltitle.height to 30 I can in Activity_Create set the lbltitle.height and log all that: B4X: Copy Log(LblTitle.Height) LblTitle.Height=30dip Log(LblTitle.Height) LblTitle.Height=30 Log(LblTitle.Height) Dim ii As Int=30 LblTitle.Height=ii Log(LblTitle.Height) 'LblTitle.Height=ii dip 'of course does not work. which gives me the values: 98 90 30 30 1. Why is the height-log first 98 and then 90? should it not be the same? 2. How can I set a dip-value with a variable.
klaus Expert Licensed User Longtime User Apr 5, 2020 #2 You have probably AutoScaleAll in the Designer Script. The first answer is with AutoScaleAll. The second in dip, your device has a scale of 3. The third and fourth values are in pixels. Don't confuse dip density independent pixel and dpi dots per inch. Upvote 0
You have probably AutoScaleAll in the Designer Script. The first answer is with AutoScaleAll. The second in dip, your device has a scale of 3. The third and fourth values are in pixels. Don't confuse dip density independent pixel and dpi dots per inch.
Pflichtfeld Active Member Licensed User Apr 5, 2020 #3 [QUOTE="klaus, post: 724388, member: 904" The first answer is with AutoScaleAll. [/QUOTE] Thank you Klaus, this was really a precious hint!! It also teaches me the principle of AutoScaleAll! My second question should be correctly be answered by: B4X: Copy LblTitle.Height=DipToCurrent(ii) Hope that is right! Upvote 0
[QUOTE="klaus, post: 724388, member: 904" The first answer is with AutoScaleAll. [/QUOTE] Thank you Klaus, this was really a precious hint!! It also teaches me the principle of AutoScaleAll! My second question should be correctly be answered by: B4X: Copy LblTitle.Height=DipToCurrent(ii) Hope that is right!
klaus Expert Licensed User Longtime User Apr 5, 2020 #4 Well, it depends on what you want to do. You have different possibilities: B4X: Copy LblTitle.Height = 30dip Dim ii As Int=30dip LblTitle.Height = ii Dim ii As Int=30 LblTitle.Height= DipToCurrent(ii) All are the same ! 30dip is the shortcut of DipToCurrent(30) Upvote 0
Well, it depends on what you want to do. You have different possibilities: B4X: Copy LblTitle.Height = 30dip Dim ii As Int=30dip LblTitle.Height = ii Dim ii As Int=30 LblTitle.Height= DipToCurrent(ii) All are the same ! 30dip is the shortcut of DipToCurrent(30)
Pflichtfeld Active Member Licensed User Apr 5, 2020 #5 klaus said: B4X: Copy Dim ii As Int=30dip 30dip is the shortcut of DipToCurrent(30) Click to expand... Again new for me. Thank you so much! Upvote 0
klaus said: B4X: Copy Dim ii As Int=30dip 30dip is the shortcut of DipToCurrent(30) Click to expand... Again new for me. Thank you so much!