B4J Tutorial Accordion container

Discussion in 'B4J Tutorials' started by Erel, Mar 19, 2017.

  1. Erel

    Erel Administrator Staff Member Licensed User

    accordion.gif

    The Accordion container (added in B4J v5.0) is a container similar to TabPane. It holds TitledPanes. These are panes with titles.

    Using the accordion is quite simple. Add the Accordion node with the designer and create a layout file for each of the TitledPanes.

    Code:
    Sub AppStart (Form1 As Form, Args() As String)
       MainForm = Form1
       MainForm.RootPane.LoadLayout(
    "Main")
       Accordion1.LoadLayout(
    "Pane1""Pane 1")
       Accordion1.LoadLayout(
    "Pane2""Pane 2")
       Accordion1.LoadLayout(
    "Pane3""Pane 3")
       MainForm.Show
    End Sub
    It is recommended to use anchors in the layouts so the layout will be resized automatically based on the available size.
     

    Attached Files:

    fredo, arastoo, Beja and 6 others like this.
  2. warwound

    warwound Expert Licensed User

  3. Erel

    Erel Administrator Staff Member Licensed User

    Fixed.
     
    arastoo and warwound like this.
  4. Cableguy

    Cableguy Expert Licensed User

    Can the TitledPanes Titles be set using other methods than the LoadLayout?
    I would like to preate the TitledPanes in code, and add view to the panes in code.
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    This is a mistake in most cases.

    You can create an empty layout and load it whenever you need. You can also create a layout file with some of the views, load it and add the "dynamic" views programmatically.
     
    Cableguy likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice