SplitterMobile()

Syntax

Result = SplitterMobile(#Mobile, MenuPage$, ContentPage$ [, Flags])
Description
Create a new mobile splitter in the current container. A splitter allow to display a dynamic menu at the right of the UI and changing the displayed page accordingly.

Parameters

#Mobile A number to identify the new mobile object. #PB_Any can be used to auto-generate this number.
MenuPage$ The case-sensitive name of the page used to display the menu. It needs to be a ContainerMobile() created with the #PB_Mobile_Template type.
ContentPage$ The case-sensitive name of the current displayed page. This page will usually have a ToolBarMobile() with an hambuger menu on the left. It needs to be a ContainerMobile() created with the #PB_Mobile_Template type.
Flags (optional) Not used for now.

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 mobile splitter:

- SetMobileState(): Display (if 'State' is 1) or hide (if 'State' is 0) the splitter menu.
- SetMobileText(): Change the current displayed page. The page name is case-sensitive.

Example

  Enumeration
    #Splitter
    #MenuList
    #SplitterButtton1
    #ToolBar2
    #SplitterButtton2
  EndEnumeration

  If ContainerMobile(#PB_Any, #PB_Mobile_Template, "", "page1")
    ToolBarMobile(#PB_Any)
      ButtonMobile(#SplitterButtton1, "md-menu", #PB_Mobile_Left | #PB_Mobile_Icon)
      TextMobile(#PB_Any, "Page 1", #PB_Mobile_Center)
    CloseMobileContainer()
    
    HtmlMobile("<center><h1>Page1 !</h1></center>")
    CloseMobileContainer()
  EndIf

  If ContainerMobile(#PB_Any, #PB_Mobile_Template, "", "page2")
    ToolBarMobile(#PB_Any)
      ButtonMobile(#SplitterButtton2, "md-menu", #PB_Mobile_Left | #PB_Mobile_Icon)
      TextMobile(#PB_Any, "Page 2", #PB_Mobile_Center)
    CloseMobileContainer()
    
    HtmlMobile("<center><h1>Page2 !</h1></center>")
    CloseMobileContainer()
  EndIf

  ; The menu to display when clicking on the hamburger menu
  ;
  If ContainerMobile(#PB_Any, #PB_Mobile_Template, "", "menu")
    ListMobile(#MenuList)
    AddListMobileItem(#MenuList, "Page 1", #PB_Mobile_NoDivider | #PB_Mobile_Tappable)
    AddListMobileItem(#MenuList, "Page 2", #PB_Mobile_NoDivider | #PB_Mobile_Tappable)
    CloseMobileContainer()
  EndIf

  SplitterMobile(#Splitter, "menu", "page1")

  Procedure MobileEvents()
    Select EventMobile()
      Case #SplitterButtton1, #SplitterButtton2
        SetMobileState(#Splitter, 1) ; Display the splitter menu
    
      Case #MenuList
        SetMobileText(0, "page"+Str(GetMobileState(#MenuList)+1))
        SetMobileState(#Splitter, 0) ; Hide the menu
    EndSelect
  EndProcedure

  BindEvent(#PB_Event_Mobile, @MobileEvents())

See Also

ChangeNavigatorMobilePage()

Supported OS

All

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