B4J Question [solved] Designer Layout Different From Runtime Layout

JHAustin

New Member
Hello All,

I'm new to B4x and am truly loving it, so Thank you to the Developers!

I created a layout and built my program and everything works very well.
I then decided to rename my Layout, and now when I open the Designer, it shows an earlier version of the layout, before I had finalized it.

Strangely enough, when I run the program, it still shows the finalized layout.
I have attached two screenshots as well as the entire project.

This is just a simple Magic 8 Ball program, to get a feel for the language:

Magic 8 Ball Code:
#Region Project Attributes
    #MainFormWidth: 800
    #MainFormHeight: 800
#End Region

Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private xui As XUI
    Private btnAsk As Button
    Private txtQuestion As TextField
    Private lblMagicAnswer As Label
    
    Private answers(20) As String
    
    answers(0) = "It Is certain."
    answers(1) = "It Is decidedly so."
    answers(2) = "Without a doubt."
    answers(3) = "Yes – definitely."
    answers(4) = "You may rely on it."
    answers(5) = "As I see it, Yes."
    answers(6) = "Most likely."
    answers(7) = "Outlook good."
    answers(8) = "Yes."
    answers(9) = "Signs point to yes."
    answers(10) = "Reply hazy, try again."
    answers(11) = "Ask again later."
    answers(12) = "Better not tell you now."
    answers(13) = "Cannot predict now."
    answers(14) = "Concentrate and ask again."
    answers(15) = "Don't count on it."
    answers(16) = "My reply is No."
    answers(17) = "My sources say No."
    answers(18) = "Outlook not so good."
    answers(19) = "Very doubtful."
    
    Dim lastQuestion As String
    
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Magic8Ball")
    MainForm.Show
End Sub

Sub btnAsk_Click
    GiveAnswer
End Sub

Sub txtQuestion_Action
    GiveAnswer
End Sub

Sub GiveAnswer
    
    If txtQuestion.Text = "" Then
        lblMagicAnswer.Text = "Yes or No Questions Please"
    Else if txtQuestion.Text = lastQuestion Then
        lblMagicAnswer.Text = "I already answered that"
    Else
        Dim magicAnswer As Int = Rnd(0, 19)
        lblMagicAnswer.Text = answers(magicAnswer)
        lastQuestion = txtQuestion.Text
    End If
    
End Sub

Any idea why this is happening and how I can get the correct Layout to show in the Designer?

Thank you,
Joe
 

Attachments

  • FinalLayout.png
    FinalLayout.png
    46.1 KB · Views: 165
  • OldLayout.png
    OldLayout.png
    38.7 KB · Views: 163
  • Magic8Ball.zip
    110 KB · Views: 177

JHAustin

New Member
Never Mind ........... If I click on the Variant that I was using, it shows the correct Layout.

Live and Learn!!

Sorry to bother everyone.
 
Upvote 0

JHAustin

New Member
Thank you for responding Erel!

I will do as you say. I was just experimenting with the variants, and didn't realize that each one could have its own layout.
This definitely brings me back to the VB6 days! I'm having a blast.

How do I mark this thread as Solved?

Thanks again!
Joe
 
Upvote 0
Top