ContainerMobile()

Syntax

Result = ContainerMobile(#Mobile, Type [, Style$ [, Page$]])
Description
Create a mobile new mobile container. Once the mobile objects have been added, it needs to be closed with CloseMobileContainer().

Parameters

#Mobile A number to identify the new mobile object. #PB_Any can be used to auto-generate this number.
Type Container type. It can be one of the following value:
  #PB_Mobile_Page    : Creates a new page which is immediately displayed. It's a top level container.
  #PB_Mobile_Template: Creates a new template which is invisible. It's a top level container.
  #PB_Mobile_Dialog  : A new dialog container which will be displayed with ShowMobile().
  #PB_Mobile_PopOver : A new pop over container which will be displayed with ShowMobile().
  #PB_Mobile_Row     : A 3 slot container. It's a child container.
  #PB_Mobile_Section : A simple section container, with no extra formatting. It's a child container.
Style$ (optional) CSS style to apply to the container.
Page$ (optional) The page identifier for this container. It is only useful for #PB_Mobile_Template container. This identifier can be used in AddTabBarMobileItem(), NavigatorMobile() and ChangeNavigatorMobilePage().

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.

Example: Main page with a button

  ; Create the main page with a single button
  ;
  If ContainerMobile(#PB_Any, #PB_Mobile_Page, "margin:8px")
    ButtonMobile(0, "Click me")
    
    CloseMobileContainer()
  EndIf
  
  ; Handle the events
  ;
  Procedure MobileEvents()
    Select EventMobile()
      Case 0
        Debug "Button clicked"
    EndSelect
  EndProcedure

  BindEvent(#PB_Event_Mobile, @MobileEvents())

Example: Simple dynamic dialog

    Enumeration
    #Dialog
    #Open
    #Close
  EndEnumeration

  ; Create the dialog content, will be only visible with ShowMobile()
  ;
  If ContainerMobile(#Dialog, #PB_Mobile_Dialog, "padding:8px")
    If ContainerMobile(#PB_Any, #PB_Mobile_Row, "padding:8px")
      TextMobile(#PB_Any, "This is a dynamic dialog box", #PB_Mobile_Center)
      CloseMobileContainer()
    EndIf
    
    If ContainerMobile(#PB_Any, #PB_Mobile_Row, "padding:8px")
      ButtonMobile(#Close, "Close", #PB_Mobile_Center)
      CloseMobileContainer()
    EndIf
    
    CloseMobileContainer()
  EndIf
  
  ; Create the main page with a single button
  ;
  If ContainerMobile(#PB_Any, #PB_Mobile_Page, "margin:8px")
    ButtonMobile(#Open, "Open the dialog")
    
    CloseMobileContainer()
  EndIf
  
  ; Handle the events
  ;
  Procedure MobileEvents()
    Select EventMobile()
      Case #Open
        ShowMobile(#Dialog, #True)
        
      Case #Close
        ShowMobile(#Dialog, #False)
        
    EndSelect
  EndProcedure

  BindEvent(#PB_Event_Mobile, @MobileEvents())

See Also

AddTabBarMobileItem(), NavigatorMobile(), ChangeNavigatorMobilePage()

Supported OS

All

<- CloseMobileContainer() - Mobile Index - DisableMobile() ->