SwitchMobile()
Syntax
Result = SwitchMobile(#Mobile, [, Flags])Description
Create a new mobile switch 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) If the current container is a 3 slots container, the following constants can be used to select in which slot the switch should be created: #PB_Mobile_Left : The switch will be set in the left slot. #PB_Mobile_Center: The switch will be set in the center slot. #PB_Mobile_Right : The switch 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 switch:
- SetMobileState(): Changes the state of the switch (1 to activate the switch, 0 to deactivate it).
- GetMobileState(): Returns the state of the switch (1 if the switch is activate, 0 if not).
The following events are supported with EventType():- #PB_EventType_LeftClick: the switch has been clicked.
Example
If ContainerMobile(#PB_Any, #PB_Mobile_Page, "padding:16px") SwitchMobile(1) CloseMobileContainer() EndIf Procedure MobileEvents() Select EventMobile() Case 1 Debug "Switch changed. State: " + GetMobileState(1) EndSelect EndProcedure BindEvent(#PB_Event_Mobile, @MobileEvents())
See Also
SetMobileState(), GetMobileState()
Supported OS
All