ButtonMobile()

Syntax

Result = ButtonMobile(#Mobile, Text$ [, Flags])
Description
Create a mobile button in the current container.

Parameters

#Mobile A number to identify the new mobile object. #PB_Any can be used to auto-generate this number.
Text$ The text to display on the button. If the flags #PB_Mobile_Icon is used, then the text will be used as icon name.
Flags (optional) It can be a combination (using the bitwise OR operator '|') of the following constants:
  #PB_Mobile_Icon      : Display an icon instead of text. The 'Text$' parameter is used as icon name.
  #PB_Mobile_BackButton: Creates a back button which is mainly used in ToolBarMobile().
If the current container is a 3 slots container, the following constants can be used to select in which slot the button should be created:
  #PB_Mobile_Left  : The button will be set in the left slot.
  #PB_Mobile_Center: The button will be set in the center slot.
  #PB_Mobile_Right : The button will be set in the right slot.

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 button:

- SetMobileText(): Changes the text of the button.
- GetMobileText(): Returns the text of the button.

The following events are supported with EventType():
  - #PB_EventType_LeftClick: the button has been clicked.

Example

  If ContainerMobile(#PB_Any, #PB_Mobile_Page, "margin:8px")
    ButtonMobile(0, "Click me")
    HtmlMobile("<br><br>")
    ButtonMobile(1, "Click me too !")
    
    CloseMobileContainer()
  EndIf

  Procedure MobileEvents()
    Select EventMobile()
      Case 0
        Debug "Button 0 clicked !"
        
      Case 1
        Debug "Button 1 clicked !"
    EndSelect
  EndProcedure

  BindEvent(#PB_Event_Mobile, @MobileEvents())

See Also

SetMobileText(), GetMobileText()

Supported OS

All

<- AlertMobile() - Mobile Index - ChangeNavigatorMobilePage() ->