I wish the documentation made it clear which value corresponded to the values one would provide back to Corona via some API call.
I.e., if I’m trying to create some object of the same on-screen/visible height, do I get the info from .height or .contentHeight? Since the values differ, the answer is clearly one or the other (or, possibly, “neither, use <somethingelse>”
The entire question arose because a prior post (someone else) asked about determining the size of a widget.newButton,
and the answer was to use .height or .contentHeight of a temporary text object with the same font size … had such buttons
possessed the same x/y/height attributes as display objects, the question wouldn’t have arisen, I suspect.
widget.newButton()s are not directly display objects. They are an object that contains a display.newGroup that holds a display.newRect and some other display objects. I don’t believe that widget.newButton has a direct .height or .width property
In most cases, I think .height and .contentHeight are going to be the same or very close unless you’ve been scaling or rotating the object. I would personally use .height in most cases.
I figured something like that (nested stuff), but decided against looking inside one to get to the nested objects … not enough reason to get dirty like that for this minor problem.
I’m currently using the min of the two, rounded to an integer value.
thanks again,
Stan (sure wish we had modern Lua with “//” integer division) Sieler
I wish the documentation made it clear which value corresponded to the values one would provide back to Corona via some API call.
I.e., if I’m trying to create some object of the same on-screen/visible height, do I get the info from .height or .contentHeight? Since the values differ, the answer is clearly one or the other (or, possibly, “neither, use <somethingelse>”
The entire question arose because a prior post (someone else) asked about determining the size of a widget.newButton,
and the answer was to use .height or .contentHeight of a temporary text object with the same font size … had such buttons
possessed the same x/y/height attributes as display objects, the question wouldn’t have arisen, I suspect.
widget.newButton()s are not directly display objects. They are an object that contains a display.newGroup that holds a display.newRect and some other display objects. I don’t believe that widget.newButton has a direct .height or .width property
In most cases, I think .height and .contentHeight are going to be the same or very close unless you’ve been scaling or rotating the object. I would personally use .height in most cases.
I figured something like that (nested stuff), but decided against looking inside one to get to the nested objects … not enough reason to get dirty like that for this minor problem.
I’m currently using the min of the two, rounded to an integer value.
thanks again,
Stan (sure wish we had modern Lua with “//” integer division) Sieler