CheckBoxMobile()
Syntax
Result = CheckBoxMobile(#Mobile, Text$ [, Flags])Description
Create a mobile checkbox 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 label to use for the checkbox. Flags (optional) If the current container is a 3 slots container, the following constants can be used to select in which slot the checkbox should be created (a checkbox can't be set in the center slot as it's always where the label will be displayed): #PB_Mobile_Left : The checkbox will be set in the left slot. #PB_Mobile_Right : The checkbox 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 label of the checkbox.
- GetMobileText(): Returns the label of the checkbox.
- SetMobileState(): Changes the state of the checkbox (1 to check the checkbox, 0 to uncheck it).
- GetMobileState(): Returns the state of the checkbox (1 if the checkbox is checked, 0 if not).
The following events are supported with EventType():- #PB_EventType_LeftClick: the checkbox has been clicked.
Example
If ContainerMobile(#PB_Any, #PB_Mobile_Page) ListMobile(0) If AddListMobileItem(0, "", #PB_Mobile_Container) CheckBoxMobile(1, "Click me left", #PB_Mobile_Left) CloseMobileContainer() EndIf If AddListMobileItem(0, "", #PB_Mobile_Container) CheckBoxMobile(2, "Click me right !", #PB_Mobile_Right) CloseMobileContainer() EndIf CloseMobileContainer() EndIf Procedure MobileEvents() Select EventMobile() Case 1 Debug "Checkbox 1 clicked. State: " + GetMobileState(1) Case 2 Debug "Checkbox 2 clicked. State: " + GetMobileState(2) EndSelect EndProcedure BindEvent(#PB_Event_Mobile, @MobileEvents())
See Also
SetMobileText(), GetMobileText(), SetMobileState(), GetMobileState()
Supported OS
All