You are here: Customizing Appearance

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:

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

For general information on the Phone widget see the Phone topic in the Kony 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.
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, Windows 8 Tablet, and Windows 7 Desktop platforms.

You can use a Phone widget in the following scenarios:

Customizing Appearance

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

Important Considerations

The following is the important consideration for a Phone widget:

J2ME: Unlike other platforms (for example, Android, BlackBerry etc) you will not be able to simulate a Phone widget behavior on an emulator.

premCopyright © 2012 Kony, Inc. All rights reserved.
premCopyright © 2012 Kony, Inc. All rights reserved.