IconMobile()

Syntax

Result = IconMobile(#Mobile, Name$ [, Flags])
Description
Create a new mobile icon in the current container.

Parameters

#Mobile A number to identify the new mobile object. #PB_Any can be used to auto-generate this number.
Name$ The name of the icon. Several icon set are availables:

Material Design Icons: to use them, use the 'md-' prefix before the name. The list of the available icons can be found here: Material Design Icons

FontAwesome icons: to use them, use the 'fa-' prefix before the name. The list of the available icons can be found here (only free icons): FontAwesome

Iconic icons: to use them, use the 'ion-' prefix before the name. The list of the available icons can be found here: IonIcons
Flags (optional) If the current container is a 3 slots container, the following constants can be used to select in which slot the icon should be created:
  #PB_Mobile_Left  : The icon will be set in the left slot.
  #PB_Mobile_Center: The icon will be set in the center slot.
  #PB_Mobile_Right : The icon 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 icon:

- SetMobileText(): Changes the icon name.
- GetMobileText(): Returns the icon name.

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

Example

  If ContainerMobile(#PB_Any, #PB_Mobile_Page, "margin: 8px")
    
    If ContainerMobile(#PB_Any, #PB_Mobile_Row)
      IconMobile(0, "md-volume-down", #PB_Mobile_Left) ; Use Material Design icon
      TrackBarMobile(1, 0, 100, 1, #PB_Mobile_Center)
      IconMobile(2, "md-volume-up", #PB_Mobile_Right)
      CloseMobileContainer()
    EndIf
    
    IconMobile(3, "ion-ios-calendar") ; Use a Ionic icon
    HtmlMobile("<br><br>")
    IconMobile(4, "fa-redhat")        ; Use a FontAwesome icon
    
    CloseMobileContainer()
  EndIf
  
  Procedure MobileEvents()
    Select EventMobile()
      Case 4
        Select EventType()
          Case #PB_EventType_LeftClick
            Debug "Icon 4 clicked"
        EndSelect
    EndSelect
  EndProcedure

  BindEvent(#PB_Event_Mobile, @MobileEvents())

See Also

SetMobileText(), GetMobileText()

Supported OS

All

<- HtmlMobile() - Mobile Index - ImageMobile() ->