ListMobile()
Syntax
Result = ListMobile(#Mobile [, Flags])Description
Create a mobile list in the current container.
Parameters
#Mobile A number to identify the new mobile object. #PB_Any can be used to auto-generate this number. Flags (optional) It can be a combination (using the bitwise OR operator '|') of the following constants: #PB_Mobile_InSet : Change the display of the list by adding border
Return value
Returns nonzero on success and zero on failure. If #PB_Any was used as the #Gadget parameter then the return-value is the auto-generated gadget number on success.
Remarks
The following functions can be used to act on the list:
- AddListMobileItem() can be used to add a new item in the list.
- GetMobileState() can be used to get the last clicked list item index (starting from 0).
Example
If ContainerMobile(#PB_Any, #PB_Mobile_Page) ListMobile(0) AddListMobileItem(0, "Header", #PB_Mobile_Header) AddListMobileItem(0, "Basic item") AddListMobileItem(0, "Basic item 2") ; List item with a container With 3 placeholder: left, center, right If AddListMobileItem(0, "Hello", #PB_Mobile_Container) TextMobile(#PB_Any, "PopOver", #PB_Mobile_Left) ButtonMobile(1, "Open PopOver !", #PB_Mobile_Center) SwitchMobile(2, #PB_Mobile_Right) CloseMobileContainer() ; Important to close the container once the item have been added EndIf AddListMobileItem(0, "Another title", #PB_Mobile_Header) AddListMobileItem(0, "Chevron", #PB_Mobile_Chevron | #PB_Mobile_Tappable) ; Expandable list item If AddListMobileItem(0, "Expandable", #PB_Mobile_Expandable) ButtonMobile(1, "Hidden button !") CloseMobileContainer() ; Important to close the container once the item have been added EndIf CloseMobileContainer() EndIf
Example: Item click detection
If ContainerMobile(#PB_Any, #PB_Mobile_Page) ListMobile(0) For k = 0 To 20 AddListMobileItem(0, "Item " + k, #PB_Mobile_Tappable | #PB_Mobile_NoDivider) Next CloseMobileContainer() EndIf Procedure MobileEvents() Select EventMobile() Case 0 Debug "Item " + GetMobileState(0) + " clicked" EndSelect EndProcedure BindEvent(#PB_Event_Mobile, @MobileEvents())
See Also
AddListMobileItem()
Supported OS
All