Phone Widget

The Phone widget is used to call a phone number in an application using the phone app of your device.

A Phone widget, when placed in an application, allows you to launch the native phone dialer, and initiate a phone call to the number that is displayed on it. It appears as a button on the Form, and the phone number is displayed on it either in the number format or the phone spell text. When the user selects the phone widget, the native phone app is launched to make a phone call.

Following are the real-time use cases of the Phone widget:

  • Used in business websites where the contact numbers are displayed.

  • In apps that offer services such as delivery of food, medicines or electronic gadgets; rider’s contact details are displayed using Phone widget. Customers can call the rider to know the status of the delivery.

  • Contact support in websites.

Widgets are normally added to your application using Quantum Visualizer, but can also be added from code. For general information on using widgets in Quantum Visualizer, see Designing an Application in the Visualizer User Guide.

For general information on the Phone widget see the Phone topic in the Quantum Visualizer User Guide.

The Phone widget capabilities can be broadly categorized into the following:

Layout

Events Description
doLayout Invoked for every widget when the widget position and dimensions are computed.
 
PropertiesDescription
anchorPoint Specifies the anchor point of the widget bounds rectangle using the widget's coordinate space.
bottom Determines the bottom edge of the widget and is measured from the bottom bounds of the parent container.
centerX Determines the center of a widget measured from the left bounds of the parent container.
centerY Determines the center of a widget measured from the top bounds of the parent container.
contentAlignment Specifies the alignment of the text for a widget with respect to its boundaries.
height Determines the height of the widget and measured along the y-axis.
hExpandSpecifies if the widget should occupy all the width available to it.
left Determines the lower left corner edge of the widget and is measured from the left bounds of the parent container.
maxHeight Specifies the maximum height of the widget and is applicable only when the height property is not specified.
maxWidth Specifies the maximum width of the widget and is applicable only when the width property is not specified.
minHeight Specifies the minimum height of the widget and is applicable only when the height property is not specified.
minWidth Specifies the minimum width of the widget and is applicable only when the width property is not specified.
padding Defines the space between the content of the widget and the widget boundaries.
paddingInPixelIndicates if the padding is to be applied in pixels or in percentage.
rightDetermines the lower right corner of the widget and is measured from the right bounds of the parent container.
top Determines the top edge of the widget and measured from the top bounds of the parent container.
vExpandSpecifies if the widget has to occupy all the vertical space available to it.
width Determines the width of the widget and is measured along the x-axis.
zIndex Specifies the stack order of a widget.
  

Animations

 
PropertiesDescription
transformContains an animation transformation that can be used to animate the widget.
 

Data Management

MethodsDescription
clone When this method is used on a container widget, then all the widgets inside the container are cloned.

 

3D Touch

MethodsDescripton
registerForPeekandPop Registers a widget to enable 3D Touch peek and pop gestures.
setOnPeek Sets and overrides the existing onPeekCallback for the widget.
setOnPop Overrides the existing onPopCallback for the widget.
unregisterForPeekandPop Unregisters a widget from 3D Touch peek and pop gestures.

User Input Handling

EventsDescription
onTouchEnd An event callback is invoked by the platform when the user touch is released from the touch surface.
onTouchMove An event callback is invoked by the platform when the touch moves on the touch surface continuously until movement ends.
onTouchStart An event callback is invoked by the platform when the user touches the touch surface.
 
MethodsDescription
addGestureRecognizer Allows you to set a gesture recognizer for a specified gesture for a specified widget.
removeGestureRecognizer Allows you to remove the specified gesture recognizer for the specified widget.
setGestureRecognizer Allows you to set a gesture recognizer for a specified gesture for a specified widget.

 

UI Appearance

PropertiesDescription
contentAlignment Specifies the alignment of the text on the Phone with respect to its boundaries.
marginDefines the space around a widget.
marginInPixelIndicates if the margin is to be applied in pixels or in percentage.
padding Defines the space between the content of the widget and the widget boundaries.
paddingInPixelIndicates if the padding is to be applied in pixels or in percentage.
widgetAlignment Indicates how a widget is to be anchored with respect to its parent.

Enabling RTL

PropertiesDescription
retainContentAlignmentHelps to retain the content alignment of the widget while applying RTL.
retainFlexPositionPropertiesHelps to retain the left, right and padding properties while applying RTL.
retainFlowHorizontalAlignmentEnables you to change the horizontal flow of the widget from left to right.

Miscellaneous

MethodsDescription
getBadge Enables you to read the badge value (if any) attached to the specified widget.
setBadge Enables you to set the badge value to the given widget at the upper, right corner of the widget.

 

PropertiesDescription
cursorTypeSpecifies the type of the mouse pointer used.

Configurations Common To All Widgets

MethodsDescription
convertPointFromWidget Allows you to convert the coordinate system from a widget to a point (receiver's coordinate system).
convertPointToWidget Allows you to convert the coordinate system from a point (receiver's coordinate system) to a widget.
removeFromParent Allows you to remove a child widget from a parent widget.
setEnabled Specifies the widget that must be enabled or disabled.
setFocus Specifies the widget on which there must be focus.
setVisibility Use this method to set the visibility of the widget. Default : true
 
PropertiesDescription
accessibilityConfig Enables you to control accessibility behavior and alternative text for the widget.
enableAllows you to make a widget visible but not actionable.
idid is a unique identifier of Phone consisting of alpha numeric characters.
isVisible Controls the visibility of a widget on the form.
parent Helps you access the parent of the widget.

 

Phone Widget Basics

NOTE: Phone widget is not applicable for Desktop Web platform.

You can use a Phone widget in the following scenarios:

  • To build applications for Native, you can use phone.dial API in your application to initiate a call.
  • The convenience of providing a call initiation feature. Which otherwise, for the call initiation feature you must use a button and define an onclick event or use a RichText widget.

Customizing Appearance

You can customize the appearance of the Phone using the following properties:

  • widgetAlignment: Specifies the alignment of the widget.
  • margin: Defines the space around a widget.
  • padding: Defines the space between the content of the widget and the widget boundaries.
  • skin: Specifies the skin.
  • focusSkin: Specifies the focus skin.
  • hExpand: Expand the widget horizontally.
  • vExpand: Expand the widget vertically.