iOS Question Take a seconds for raise Page1_Resize

Pooya1

Active Member
Licensed User
There is a problem in Resize event when it raise after show page
I have a Show subroutine when i call it,it show page
And after show page,the Page1_Resize event is raised
It is working
But i add below code in i show page
Log("After show page : " & DateTime.Time(DateTime.Now))
and again use mention code in Page1_Resize
Log("When page_resize event raised : " & DateTime.Time(DateTime.Now))

Result is example :
After show page : 20:12:20
When page_resize event raised : 20:12:21

It take 500ms for raise page1_resize event

My show function is :
B4X:
Sub Show
   
    Page1.Initialize("Page1")
    Page1.Tag    =    "profile"
    Page1.RootPanel.LoadLayout("frmprofile")
Views.ChangePanelFont(Page1.RootPanel,Alis.GetAppFont)
    Alis.ShowPage(Page1)
    Log("After show page : " & DateTime.Time(DateTime.Now))
   
End Sub

Sub Page1_Resize(Width as int,Height as int)
Log("When page_resize event raised : " & DateTime.Time(DateTime.Now))
End Sub

The ChangePanelFont subroutine,change all views font in 100 ms (I removed it but result is same)
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Make sure not to initialize the page multiple times.

I've tested it with the "three pages" example with this code:
B4X:
Sub Process_Globals
   Private pg As Page
   Private btnSelectColor As Button
   Private Label1 As Label
   Private t As Long
   
End Sub

Public Sub Show
   If pg.IsInitialized = False Then
       pg.Initialize("pg")
       pg.RootPanel.LoadLayout("Page1Layout")
       pg.HideBackButton = True '<-- don't want to allow the user to return to the login screen
   End If
   Label1.Text = "Hello " & LoginModule.txtName.Text
   Main.NavControl.ShowPage(pg)
   t = DateTime.Now
End Sub

Sub pg_Resize (Width As Float, Height As Float)
   pg.Title = DateTime.Now - t
End Sub
Takes 23 milliseconds in release mode.
 
Upvote 0

Pooya1

Active Member
Licensed User
Thanks
But for first show page it take 500ms and for other time,i check page initializing state and then show it
Maybe layout affect on speed?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…