What's a Panel for?

School Boy Error

Member
Licensed User
Longtime User
Hi,

I'm reading the B4A Beginners Guide and have created the beginning of the app I'm trying to design. I've built the activity using the developer tab and manually put buttons, pictures, labels etc where I want them.

Throughout the book it refers to a panel but I can't get a picture of it in my head. It is something that you dynamically build onto? It is something that sits on top of one activity so you can keep replacing panels instead of activities? Do the buttons and things actually "attach" to the panel?

Thanks,

A confused newbie
 

joseluis

Active Member
Licensed User
Longtime User
A panel is a container view. Its function is to hold other views.

You can load layouts on it and also buttons, labels... or nest other panels.

It also has events and a background you can change.

Panels are very useful.
 
Upvote 0

latcc

Banned
Consider a panel similar to a picture frame that holds a picture on your wall. You can place a set of views (buttons, text boxes, image holders and so on within this frame and show the frame when you wish those view objects to be visible. This means you do not have to show/hide each element (view) of a frame (panel) individually, you just manipulate the frame (panel) itself. You can size a frame to fit the screen or to be only a small area of the screen. So it is a most important 'view' for creating an app. It can hold most any view including other 'frames' (panels.
 
Upvote 0

DouglasNYoung

Active Member
Licensed User
Longtime User
An Activity is a block of program and processing logic. It is possible to program your application in a single activity, yet you will still most likely need more than one screen!
You hit the nail on the head in your original post - You can have many Layouts, each with many panels which can be visible or not all in one Activity!
B4A is a flexible tool and there are many ways to achieve any goal - You don't have to use Panels, but as explained in other replies it is a useful container and will most likely make you application simpler (one you get your head round them).

Douglas
 
Upvote 0

School Boy Error

Member
Licensed User
Longtime User
Thanks, I think I'm beginning to get the gist. The problem is that all the examples I have are built through the code so I can't drag it around in the Designer and physically see what it is that they're talking about!
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Have a look at the Beginner's Guide chapter 3 Second program.
There you have a Panel for the keyboard added in the Deigner.
This panel doesn't cover the whole screen but is a container for the keyboard.
One advantage is if you want to hide or to move all the keys you just hide or move the Panel.
All views included the panel are hidden or moved.

And also chapter 12.1 User interfaces.
In this case the Panels are added in the code, but the layouts are defined in the Designer.
Each panel contains a page where you can add the views you want.
To display the different pages you manage it with the Visible property.

Best regards.
 
Last edited:
Upvote 0

wl

Well-Known Member
Licensed User
Longtime User
An additional advantage is that when you put controls onto a panel, they receive relative positions (in respect to the panel). So when you move the panel, these controls will move as well.
 
Upvote 0
Top