ChangeNavigatorMobilePage()

Syntax

ChangeNavigatorMobilePage(#Mobile, Action [, Page$])
Description
Change the current mobile navigator page.

Parameters

#Mobile The mobile object to use.
Action The action to perform. It can be one of the following constant:
  #PB_Mobile_Push: Push a new page on the stack. The "Page$" parameter needs to be specified.
  #PB_Mobile_Pop : Pop the current page and displayed the previous page.
Page$ (optional) The case-sensitive name of the page to push. It needs to be a ContainerMobile() created with the #PB_Mobile_Template type.

Return value

None.

Example

  Enumeration
    #Navigator
    #Button1
    #Button2
    #Button3
  EndEnumeration

  ; Create 3 different pages. It needs to be of 'Template' style to be used with the Navigator as they are hidden/shown on demand.
  ;
  If ContainerMobile(#PB_Any, #PB_Mobile_Template, "", "page1")
    If ToolBarMobile(#PB_Any)
      TextMobile(#PB_Any, "Page 1", #PB_Mobile_Center)
      CloseMobileContainer()
    EndIf
    
    ButtonMobile(#Button1, "Push page 2", #PB_Mobile_Right)
    CloseMobileContainer()
  EndIf

  If ContainerMobile(#PB_Any, #PB_Mobile_Template, "", "page2")
    If ToolBarMobile(#PB_Any)
      ButtonMobile(#PB_Any, "Page 1", #PB_Mobile_Left | #PB_Mobile_BackButton) ; Back button flag adds an automatic back arrow on the toolbar
      TextMobile(#PB_Any, "Page 2", #PB_Mobile_Center)
      CloseMobileContainer()
    EndIf
    
    ButtonMobile(#Button2, "Push page 3", #PB_Mobile_Right)
    CloseMobileContainer()
  EndIf

  If ContainerMobile(#PB_Any, #PB_Mobile_Template, "", "page3")
    If ToolBarMobile(#PB_Any)
      ButtonMobile(#PB_Any, "Page 2", #PB_Mobile_Left | #PB_Mobile_BackButton)
      TextMobile(#PB_Any, "Page 3", #PB_Mobile_Center)
      CloseMobileContainer()
    EndIf
    
    TextMobile(#PB_Any, "Page 3", #PB_Mobile_Center)
    ButtonMobile(#Button3, "Back", #PB_Mobile_Right)
    CloseMobileContainer()
  EndIf

  ; Create the Navigator, initialized with the first page
  ;
  NavigatorMobile(#Navigator, "page1") 


  Procedure MobileEvents()
    Select EventMobile()
      Case #Navigator
        Debug "Page changed"
        
      Case #Button1
        ChangeNavigatorMobilePage(#Navigator, #PB_Mobile_Push, "page2")
        
      Case #Button2
        ChangeNavigatorMobilePage(#Navigator, #PB_Mobile_Push, "page3")
        
      Case #Button3
        ChangeNavigatorMobilePage(#Navigator, #PB_Mobile_Pop)
     EndSelect
    
  EndProcedure

  BindEvent(#PB_Event_Mobile, @MobileEvents())

See Also

NavigatorMobile()

Supported OS

All

<- ButtonMobile() - Mobile Index - CheckBoxMobile() ->