InputMobile()

Syntax

Result = InputMobile(#Mobile, Text$ [, PlaceHolder$ [, Flags]])
Description
Create a mobile input 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 initial text to display in the input.
PlaceHolder$ (optional) The placeholder text of the input (displayed when no text is entered).
Flags (optional) It can be one of the following constants:
  #PB_Mobile_Search  : Add a search indicator to the input.
  #PB_Mobile_Password: A password input field, with hidden characters.
  #PB_Mobile_Numeric : A numeric only entry.
If the current container is a 3 slots container, the following constants can be used to select in which slot the input should be created:
  #PB_Mobile_Left  : The input will be set in the left slot.
  #PB_Mobile_Center: The input will be set in the center slot.
  #PB_Mobile_Right : The input 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 input:

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

The following events are supported with EventType():
  - #PB_EventType_Change   : the input content has changed.
  - #PB_EventType_Focus    : the input got the focus.
  - #PB_EventType_LostFocus: the input lost the focus.

Example

  If ContainerMobile(#PB_Any, #PB_Mobile_Page)
    InputMobile(1, "ju", "Search a name", #PB_Mobile_Search)
    
    CloseMobileContainer()
  EndIf

  Procedure MobileEvents()
    Select EventMobile()
      Case 1
        Select EventType()
          Case #PB_EventType_Focus
            Debug "Got the focus"
            
          Case #PB_EventType_LostFocus
            Debug "Focus lost"
            
          Case #PB_EventType_Change
            Debug "Content changed: "+GetMobileText(1)
        EndSelect
    EndSelect
  EndProcedure

  BindEvent(#PB_Event_Mobile, @MobileEvents())

See Also

SetMobileText(), GetMobileText()

Supported OS

All

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