How to show and hide layout (xxx.bal)

grant1842

Active Member
Licensed User
Longtime User
I am new B4A development.
I have use Borlands Delphi for years to do windows apps.
I really like this software I am having a few problems with some basic stuff.
I made a new layout (FORM) in the designer (ContactUs.bal).

I have a menu item on the main form.

B4X:
Sub ContactUs_Click

Activity.LoadLayout("ContactUs.bal")

lbl_contact.Visible= True
lbl_contact.BringToFront

Activity.AddView(lbl_contact,3,50,76,76)
End Sub

this code gives an error about removing view of parent.

I am looking for help on displaying and closing these .bal (forms) .

Thanks for your help.
 

NJDude

Expert
Licensed User
Longtime User
If you create layouts using the designer you DO NOT have to do this:
B4X:
Activity.AddView(lbl_contact,3,50,76,76)

The error you mentioned happens because you are trying to add a view already added to the activity, you don't have to do it if you create layouts using the designer as I mentioned above.

Regarding "closing" layouts, what exactly you want to do? layouts cannot be "closed" in B4A.
 
Upvote 0

grant1842

Active Member
Licensed User
Longtime User
Thanks for your help.
Can you give me a proper example on how to show the ContactUs.bal .
It just has a label1 on it.

Thanks.
 
Upvote 0
Top