B4J Question [SOLVED] TabPane opened step-by-step with Buttons - How to?

Discussion in 'B4J Questions' started by JOTHA, Jun 29, 2019.

Similar threads

B4J Tutorial TabPane Example
B4J Tutorial Pagination Container
B4J Tutorial Accordion container
B4J Tutorial [B4X] Resumable Subs - Sleep / Wait For
B4J Tutorial Charts Framework
  1. JOTHA

    JOTHA Well-Known Member Licensed User

    Hello community,

    i have an example with 3 Tabs, but i don't want to open all Tabs at once.
    They should be opened step-by-step with a Button_Click (forwards and backwards).

    The problem is that the Tabs are opened more than one time, so i have several times opened Tab1 ...
    How can i prevent the Tabs opening for more than one time (once)?
    Attached is an example ...
     

    Attached Files:

  2. Daestrum

    Daestrum Well-Known Member Licensed User

    try this - (although personally I would add all the tabs before displaying tabpane and just have 2 buttons forward and back - with back disabled on first page and forward disabled on last page)

    Code:
    Sub Process_Globals
     
    Private fx As JFX
     
    Private MainForm As Form
     
    Private TabPane1 As TabPane
     
     
    Private Button1 As Button
     
    Private Button2 As Button
     
    Private Button3 As Button
     
    Private Pane1 As Pane
     
    Private Pane2 As Pane
     
    Private Shown1,Shown2,Shown3 As Boolean  ' <<<<<<<<<<<<<<< new bit
    End Sub
    Sub AppStart (Form1 As Form, Args() As String)
     MainForm = Form1
     MainForm.RootPane.LoadLayout(
    "1")
     MainForm.Show
     MainForm.Stylesheets.Add(
    File.GetUri(File.DirAssets, "TabPane.css"))
     TabPane1.LoadLayout(
    "2""Tab 1")
     Shown1=
    True
    End Sub
    Sub Button1_Click  'forward to Tab 2
     If Shown2=False Then
      TabPane1.LoadLayout(
    "3""Tab 2")
      Shown2=
    True
     
    End If
     TabPane1.SelectedIndex = 
    1
    End Sub
    Sub Button2_Click  'back to previous
     If Shown1=False Then 
      TabPane1.LoadLayout(
    "2""Tab 1")
      Shown1=
    True
     
    End If
     TabPane1.SelectedIndex = TabPane1.SelectedIndex - 
    1
    End Sub
    Sub Button3_Click  'forward to Tab 3
     If Shown3=False Then
      TabPane1.LoadLayout(
    "3""Tab 3")
      Shown3=
    True
     
    End If
     TabPane1.SelectedIndex = 
    2
    End Sub
     
    Erel and JOTHA like this.
  3. JOTHA

    JOTHA Well-Known Member Licensed User

    Hi Daestrum,

    thank you very much for your help!
    I made a B4J - TabPane with 6 Tabs and "Forward- + Backward-Buttons" for those who find this usefull (see attachment).
     

    Attached Files:

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