LordZenzo Well-Known Member Licensed User Longtime User Jun 5, 2019 #1 this simple operation generates an error in the compilation Code: LS1.Padding=Array (6.7%x ,0dip,0dip,0dip) [\CODE] in the forum I found this solution [CODE] Sub IntToDIP(Integer As Int) As Int Dim DIP As Int DIP = Integer * 1dip Return DIP End Sub [\CODE]
this simple operation generates an error in the compilation Code: LS1.Padding=Array (6.7%x ,0dip,0dip,0dip) [\CODE] in the forum I found this solution [CODE] Sub IntToDIP(Integer As Int) As Int Dim DIP As Int DIP = Integer * 1dip Return DIP End Sub [\CODE]
Star-Dust Expert Licensed User Longtime User Jun 5, 2019 #2 To have greater precision and avoid the rounding of 1Dip, Erel suggested to work 100dip / 100. The error is perhaps generated by the fact that you use reserved KeyWords Code: Sub IntToDIP(Value As Int) As float Return Value*(100dip/100) End Sub Upvote 0
To have greater precision and avoid the rounding of 1Dip, Erel suggested to work 100dip / 100. The error is perhaps generated by the fact that you use reserved KeyWords Code: Sub IntToDIP(Value As Int) As float Return Value*(100dip/100) End Sub
LordZenzo Well-Known Member Licensed User Longtime User Jun 5, 2019 #3 no this is error in the compilation LS1.Padding=Array(IntToDIP(4%x),0dip,0dip,0dip) javac 1.8.0_131 src\com\iliad\gilo\main.java:493: error: incompatible types: Object[] cannot be converted to int[] parent.mostCurrent._ls1.setPadding((int[])(new Object[]{(Object)(_inttodip(anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (4),mostCurrent.activityBA))),(Object)(anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (0))),(Object)(anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (0))),(Object)(anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (0)))})); Upvote 0
no this is error in the compilation LS1.Padding=Array(IntToDIP(4%x),0dip,0dip,0dip) javac 1.8.0_131 src\com\iliad\gilo\main.java:493: error: incompatible types: Object[] cannot be converted to int[] parent.mostCurrent._ls1.setPadding((int[])(new Object[]{(Object)(_inttodip(anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (4),mostCurrent.activityBA))),(Object)(anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (0))),(Object)(anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (0))),(Object)(anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (0)))}));
Star-Dust Expert Licensed User Longtime User Jun 5, 2019 #4 Try it Code: Dim V as Int =IntToDIP(4%x) LS1.Padding=Array(V,0dip,0dip,0dip) Upvote 0
LucaMs Expert Licensed User Longtime User Jun 5, 2019 #5 LordZenzo said: LS1.Padding=Array (6.7%x ,0dip,0dip,0dip) Click to expand... LS1.Padding = Array As Int (6.7%x ,0dip,0dip,0dip) Upvote 0
LordZenzo said: LS1.Padding=Array (6.7%x ,0dip,0dip,0dip) Click to expand... LS1.Padding = Array As Int (6.7%x ,0dip,0dip,0dip)
LordZenzo Well-Known Member Licensed User Longtime User Jun 5, 2019 #6 LucaMs said: LS1.Padding = Array As Int (6.7%x ,0dip,0dip,0dip) Click to expand... what a shame, a beginner's mistake Upvote 0
LucaMs said: LS1.Padding = Array As Int (6.7%x ,0dip,0dip,0dip) Click to expand... what a shame, a beginner's mistake
E emexes Expert Licensed User Longtime User Jun 6, 2019 #7 LordZenzo said: Code: Sub IntToDIP(Integer As Int) As Int Click to expand... Super-minor point, but... I think this function converts DIPs to P(ixel)s, ie, the opposite of its name. Perhaps rename it to DIPToPixel() or PixelFromDIP(). Upvote 0
LordZenzo said: Code: Sub IntToDIP(Integer As Int) As Int Click to expand... Super-minor point, but... I think this function converts DIPs to P(ixel)s, ie, the opposite of its name. Perhaps rename it to DIPToPixel() or PixelFromDIP().
E emexes Expert Licensed User Longtime User Jun 6, 2019 #8 Star-Dust said: To have greater precision and avoid the rounding of 1Dip, Erel suggested to work 100dip / 100. Click to expand... Whilst down in the mud of pedant detail here... Since DIP's are defined as 160 per inch, I've been using 160DIP / 160 as the conversion factor, which likely cancels out an integer rounding based on the DIP suffix probably being equivalent to the integer operations: * DevicePPI / 160. On the one hand, we're only talking about being one pixel out; on the other hand, sometimes one pixel errors stand out like a star in the night sky, especially if there's a line of them. Last edited by a moderator: Jul 9, 2020 Upvote 0
Star-Dust said: To have greater precision and avoid the rounding of 1Dip, Erel suggested to work 100dip / 100. Click to expand... Whilst down in the mud of pedant detail here... Since DIP's are defined as 160 per inch, I've been using 160DIP / 160 as the conversion factor, which likely cancels out an integer rounding based on the DIP suffix probably being equivalent to the integer operations: * DevicePPI / 160. On the one hand, we're only talking about being one pixel out; on the other hand, sometimes one pixel errors stand out like a star in the night sky, especially if there's a line of them.