Hello,
When I try to print the value of display.screenOriginY, the result depends if it’s calculated " too quick " by the program.
Why ?
On my huawei y6 device, (pixel perfect on my build.setting file) I know I have this :
display.screenOriginY= - 24 ( same size of my statusBar’s height )
display.actualContentHeight = 640
display.contentHeight = 592 ( = 640 - 24 - 24 (from the bottom too))
local t=display.newText({text="", x=100, y=100 ,fontSize=30}) Runtime:addEventListener("system",function(event) if event.type=="applicationStart" then t.text=display.screenOriginY.."/onStartEvent" --It's 0 ! end end)
timer.performWithDelay( 500, function() t.text=display.screenOriginY.."/after 500 ms" end) --0 again timer.performWithDelay( 2000, function() t.text=display.screenOriginY.."/after 2000 ms" end) --And now it's -24 (correct value)
Is there a " best " method to get this value ? ( after doing a transition to a first composer for example )
The system listener don’t ( ! ) give the right value ??
(I was thinking that the applicationStart event occur after reading the whole main.lua file.)
Perhaps it’s because the program take a long to load the display library to take the “screenOriginY” value ?
Thanks,
Yvan