TabBarMobile()

Syntax

Result = TabBarMobile(#Mobile [, Flags])
Description
Create a new mobile tabbar in the current container. A new container is automatically opened and AddTabBarMobileItem() can be called to add as many tabs as needed. CloseMobileContainer() has to be called once all the tabs have been added.

Parameters

#Mobile A number to identify the new mobile object. #PB_Any can be used to auto-generate this number.
Flags (optional) It can be a combination (using the bitwise OR operator '|') of the following constants:
  #PB_Mobile_Swipeable: Enable swipe support to change the tabs.

Return value

Returns nonzero on success and zero on failure. If #PB_Any was used as the #Mobile parameter then the return-value is the auto-generated number on success.

Remarks

The following functions can be used to act on the tabbar:

- AddTabBarMobileItem(): Add a new tab (at the end) in the tabbar.
- SetMobileState(): Changes the current displayed tab (first tab index is 0).
- GetMobileState(): Returns the current displayed tab (first tab index is 0).
- SetMobileAttribute(): Changes the tab attribute value. The following attributes are supported:
    #PB_Mobile_TabLabel     : Change the tab label
    #PB_Mobile_TabIcon      : Change the displayed tab icon
    #PB_Mobile_TabActiveIcon: Change the displayed tab active icon
    #PB_Mobile_TabBadge     : Change the number of tab badges

- GetMobileAttribute(): Get the tab attribute value.
    #PB_Mobile_TabLabel     : Get the tab label
    #PB_Mobile_TabIcon      : Get the tab icon name
    #PB_Mobile_TabActiveIcon: Get the tab active icon name
    #PB_Mobile_TabBadge     : Get the number of tab badges


The following events are supported with EventType():
  - #PB_EventType_Change: the current displayed tab has been changed.

Example

  ; Template page 1 for the TabBar.
  ;
  If ContainerMobile(#PB_Any, #PB_Mobile_Template, "", "tab1")
    HtmlMobile("Tab 1")
    CloseMobileContainer()
  EndIf

  ; Template page 2 for the TabBar
  ;
  If ContainerMobile(#PB_Any, #PB_Mobile_Template, "", "tab2")
    HtmlMobile("Tab 2")
    CloseMobileContainer()
  EndIf

  ; Template page 3 for the TabBar
  ;
  If ContainerMobile(#PB_Any, #PB_Mobile_Template, "", "tab3")
    HtmlMobile("Tab 3")
    CloseMobileContainer()
  EndIf

  ; This is the main page
  ;
  If ContainerMobile(#PB_Any, #PB_Mobile_Page, "", "")
    
    If TabBarMobile(0, #PB_Mobile_Swipeable)
      AddTabBarMobileItem(0, "", "md-face", "md-face", "tab1")
      AddTabBarMobileItem(0, "Info", "", "", "tab2")
      AddTabBarMobileItem(0, "Params", "md-settings", "md-settings", "tab3", 5)
      CloseMobileContainer()
    EndIf

    CloseMobileContainer()
  EndIf

See Also

SetMobileState(), GetMobileState(), SetMobileAttribute(), GetMobileAttribute(), CloseMobileContainer()

Supported OS

All

<- SwitchMobile() - Mobile Index - TextMobile() ->