B4J Question Object not showing on form

microbox

Active Member
Licensed User
Longtime User
Hi everyone, I'm trying the latest version of B4J. I created a form with a button. But when running the program there is only a blank form. I also make sure that I'm calling the correct layout... Am I missing something?

B4X:
#Region  Project Attributes
    #MainFormWidth: 400
    #MainFormHeight: 400
#End Region

Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private btnmsg As Button
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.SetFormStyle("UNIFIED")
    MainForm.RootPane.LoadLayout("Layout1")
    MainForm.Show

Thanks in advance,
microbox
 

derez

Expert
Licensed User
Longtime User
You have to add the button to the form, like in this:
B4X:
    btnmsg.Initialize("btnmsg")
MainForm.RootPane.AddNode(btnmsg,250,250,90,50)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top