Android Question How can I load different panels with buttons

RushilD

Member
Licensed User
Hello,

I am trying to create a dashboard where on the left side I have 5 buttons. When the App starts I would like to show a homescreen (Default view)
When I click for example on button 2 I would like to load a panel on top of the homescreen.
Similarly I would like to do it for other buttons. Every button is linked to one panel.

Can someone point me to an example or show me how can I do this ?

Thank you
 

josejad

Expert
Licensed User
Longtime User
Hi RushilD:

You can simply add the panels to your layout, and set their "visible" property to false.
Then, in the button_click event, set it to true.

i.e. (not tested)
B4X:
...
pnlsArray = Array As Panel(Panel0, Panel1, Panel3, ...)
 
...

Private Sub Button3_Click
  'Hide any other visible panel
    For i = 0 To pnlsArray.Length - 1
        pnlsArray(i).visibility= false
    Next
  Panel3.visible = true
End Sub
 
Upvote 0

RushilD

Member
Licensed User
Hi RushilD:

You can simply add the panels to your layout, and set their "visible" property to false.
Then, in the button_click event, set it to true.

i.e. (not tested)
B4X:
...
pnlsArray = Array As Panel(Panel0, Panel1, Panel3, ...)
 
...

Private Sub Button3_Click
  'Hide any other visible panel
    For i = 0 To pnlsArray.Length - 1
        pnlsArray(i).visibility= false
    Next
  Panel3.visible = true
End Sub
Jose Thank you for reply.

For example (below image is just an example).

There are button on the left side. Every time I click on a particular button the black rectangle area will load / display a new panel linked to the button
So I will have 5 button and 5 panels.

Every panel will be unique in it own meaning it will have different information.


dashboard example.jpg
 
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
For me, I create a big panel, and based on the menu item that's clicked, I remove and load new layout in that big panel ( content area.)

Check these demo and other tutorial on my YouTube channel.

 
Upvote 0

RushilD

Member
Licensed User
For me, I create a big panel, and based on the menu item that's clicked, I remove and load new layout in that big panel ( content area.)

Check these demo and other tutorial on my YouTube channel.

Mcqueccu thank you for your reply. I want to do something similar.

When you say "load new layout in that big content panel (content area)"

Do you load the complete layout or only just the panel in the content area ?
If it's only the panel in the content area can you share some example how I can do this ?
 
Upvote 0

RushilD

Member
Licensed User
Remove first layout, then Load complete layout of the second page

B4X:
pnlLayoutLoader.RemoveAllViews
pnlLayoutLoader.LoadLayout("myNewLayout")

Mcqueccu OK understood. Thank you so much.

Just one more doubt. Second layout would also contain the buttons on the left correct ? So that when it is loaded I can switch again to the first one similarly
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
Just one more doubt. Second layout would also contain the buttons on the left correct ?
No, the panels layouts just contain the panel elements.

check the attached project
 

Attachments

  • layouts.zip
    16.3 KB · Views: 182
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
Mcqueccu OK understood. Thank you so much.

Just one more doubt. Second layout would also contain the buttons on the left correct ? So that when it is loaded I can switch again to the first one similarly
No, the buttons on the left (menu) will be static. It wont change or be removed
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
see dashboard demo, load paneles o class.

 
Last edited:
Upvote 0
Top