NavigatorMobile()
Syntax
Result = NavigatorMobile(#Mobile, Page$, [, Flags])Description
Create a new mobile navigator in the current container. A navigator allow to stack pages and to unstack them easily. When a ToolBarMobile() is also created on the page, an automatic back button can be added.
Parameters
#Mobile A number to identify the new mobile object. #PB_Any can be used to auto-generate this number. Page$ The case-sensitive name of the first page to use. It needs to be a ContainerMobile() created with the #PB_Mobile_Template type. Flags (optional) It can be a combination (using the bitwise OR operator '|') of the following constants: #PB_Mobile_Swipeable: Enable swipe support to unstack the pages.
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 navigator:
- ChangeNavigatorMobilePage(): Change the current displayed page.
The following events are supported with EventType():- #PB_EventType_Change: the current displayed page has been changed.
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
ChangeNavigatorMobilePage()
Supported OS
All