Perspective Number Keypad

Below are the instructions for adding a number keypad popup to a perspective view

1. Download the keypad from here

2. Unzip download to access correct zip file


3. In Designer, select File > Import


4. In Open pop up, select the keypad.zip file and click open


5. In Import pop up, Select all items and select Import


Creating popup

1. Navigate to the view with the numeric entry field

2. Deep select the numeric entry field

3. Setup custom properties

​a. Select “Add Custom Property”

​b. Select “Object” and type “keypad” all lowercase


​c. Select “Add Object Members” and add "title", "units", "centerScreen"


4. Setup the popup

​a. Right click the numeric entry field and select “Configure Event” or type “Ctrl + J”


​b. Select Mouse Events > onMouseDown then click the plus icon and select “Script”


​c. Paste the following script into Script field and select “OK”

popParams = {'owner': self.meta.name, 'min': self.props.inputBounds.minimum, 'max': self.props.inputBounds.maximum, 'oldValue': self.props.value, 'units': self.custom.keypad.units}	
posit = None if self.custom.keypad.centerScreen else {'left': event.clientX, 'top': event.clientY}	
system.perspective.openPopup('keypadPopup-' + self.meta.name, 'Exchange/Keypad/Numeric Popup', title=self.custom.keypad.title, params=popParams, position=posit, showCloseIcon=True, draggable=True, resizable=True, viewportBound=True, modal=True, overlayDismiss=True)

​Snippet of script:

​d. Right click the numeric entry field and select “Configure Scripts” or type “Ctrl + K”

​e. Select “+ Add Handler

​f. Type “keypadReturn” in the Message Type field

​g. Paste the following script in the Script field:

if self.meta.name == payload['owner']:
	self.props.value = float(payload['value'])

Snippet of script:



5. Click Save

Instructions Video
Important Notes
  • Each input field should have a unique name as this is passed as the "owner" of the popup so that only that input field receives the value that is entered on the popup.
Shoutout
  • Thanks to Michael Flagler from Innovative Control Solutions for creating this keypad!
  • Thanks to David Stone with GPS Electrical Services for creating the original version
Resources


Andrew Ott June 11, 2023
Share this post
Sign in to leave a comment