Skip to main content
Version: 7.9

system.gui.showNumericKeypad

This function is used in Python Scripting.

Description

Displays a modal on-screen numeric keypad, allowing for arbitrary numeric entry using the mouse, or a finger on a touchscreen monitor. Returns the number that the user entered.

Client Permission Restrictions

This scripting function has no Client Permission restrictions.

Syntax

system.gui.showNumericKeypad(initialValue [, fontSize][, usePasswordMode] )

Parameters

TypeParameterDescription
NumberinitialValueThe value to start the on-screen keypad with.
intfontSizeThe font size to display in the keypad. [optional]
booleanusePasswordModeIf True, display a * for each digit. [optional]

Returns

Number - The value that was entered in the keypad.

Scope

Client

Code Examples

Example #1
# This function is a holdover for backwards compatibility. Input components now know when the client is in touchscreen mode and respond accordingly. 
# This script would go in the MouseClicked or MousePressed action of a Text Field or Numeric Text Field.

# For Integer Numeric Text Field:
if system.gui.isTouchscreenModeEnabled():
event.source.intValue = system.gui.showNumericKeypad(event.source.intValue)

# For Double Numeric Text Field:
if system.gui.isTouchscreenModeEnabled():
event.source.doubleValue = system.gui.showNumericKeypad(event.source.doubleValue)

# For Text Field:
# notice the str() and int() functions used to convert the text to a number and
# vice versa.
# str() and int() are built-in Jython functions
if system.gui.isTouchscreenModeEnabled():
event.source.text = str(system.gui.showNumericKeypad(int(event.source.text)))