iOS Question Default project-cannot see button

rfresh

Well-Known Member
Licensed User
Longtime User
I'm using the basic project template. In Designer I added a Button and a Label.

I compile and load it (Debug mode) into my iPad. The Button and Label do not show. Is there something else I need to do to be able to see them? Their .Visible properties are set to True.

B4X:
'Code module
#Region  Project Attributes 
    #ApplicationLabel: B4i Example
    #Version: 1.0.0 
    'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
    #iPhoneOrientations: Portrait, LandscapeLeft, LandscapeRight
    #iPadOrientations: Portrait, LandscapeLeft, LandscapeRight, PortraitUpsideDown
    #Target: iPhone, iPad
    #ATSEnabled: True
    #MinVersion: 7
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    Public App As Application
    Public NavControl As NavigationController
    Private Page1 As Page

    Private Button1 As Button
    Private Label1 As Label
End Sub

Private Sub Application_Start (Nav As NavigationController)
    'SetDebugAutoFlushLogs(True) 'Uncomment if program crashes before all logs are printed.
    NavControl = Nav
    Page1.Initialize("Page1")
    Page1.Title = "Page 1"
    Page1.RootPanel.Color = Colors.White
    NavControl.ShowPage(Page1)
   
    Sleep(100)
End Sub

Private Sub Page1_Resize(Width As Int, Height As Int)
   
End Sub

Private Sub Application_Background
   
End Sub
 

Attachments

  • 2018-12-27_195635.png
    2018-12-27_195635.png
    70.7 KB · Views: 241

monic

Active Member
Licensed User
Longtime User
You have forgotten to load the layout and not sure why you have a sleep in their.
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
Ahhh yes, I added

B4X:
Page1.RootPanel.LoadLayout("Main")

and that fixed it. Much thanks for that.

Question:

I have

B4X:
Page1.Title = "Page 1"

set in my code but I only see "Page" at the top title bar, not "Page 1" as I expected to see.
 
Upvote 0

monic

Active Member
Licensed User
Longtime User
Easy fix call Page.Title after you load the layout as its getting overwritten by the layout title or change the title in layout.

B4X:
Page1.RootPanel.LoadLayout("Main")
Page.Title = "Page 1"
 
Upvote 0
Top