1. Outline
This method calls for the numeric keypad to be used when entering numerical values. The numeric keypad is created as a subform.
The sample project used in the explanation can be downloaded from the following link. We hope you will take advantage of it.
2. Operation image
3. Implementation method (explanation of key points only)
3-1. Screen Creation
Create a new screen and place the necessary controls.
Create two screens, one main and one numeric keypad.
3-1-1. Main Screen
(1) Button
When selected, this control calls up the "3-1-2. numeric keypad screen. The numbers entered on the numeric keypad are reflected.
(2) Sub form
The control of the numeric keypad. Toggle the visible state to show/hide.
3-1-2. Numeric Keypad Screen
(1) Text
This control displays the numeric value entered on the numeric keypad. When the numeric keypad screen appears, it retains the values set on the main screen.
(2) Button
This control clears the value entered in ②-1 ①.
(ii) This control is used to input the number of the 2-2 button into (1).
This control sets the numeric value entered in ②-3 ① to the button of "3-1-1. Main screen" which is the call source, and exits the numeric keypad.
3-2. Logic implementation
3-2-1. Global variable settings
The exchange of numbers between the main screen and the numeric keypad screen is done by setting the form and control holding the numbers in a global variable and then retrieving the contents in the content set process. Note that "number" is used because it is treated as a character string, not a numerical value. For this reason, the conversion process between numbers and strings is performed throughout the logic.
variable name |
---|
Result set destination form name |
Result set destination control name |
3-2-2. Numeric Keypad Activation
This is the process when a button is pressed on the main screen. The number displayed on the button is set as the initial value of the numeric keypad to display the numeric keypad subform.
Obtain the form on the main screen and the "1) button" control that was pressed by processing "2.
Each is then set to a global variable.
Through these global variables, the numbers are obtained from the buttons on the main screen in the "7. Get Initial Value" process.
Then, activate the numeric keypad by setting the "Visibility Status" of the subform to "Visible".
3-2-3. Numeric Keypad Input
This is the logic that runs when the number buttons 0-9 are pressed.
First, obtain numerical values from "①Labels" on the numeric keypad screen, treat them as character strings, and process them.
In the "7. Input data concatenation" process, the value of the label of the numeric button that was pressed is obtained and added to the right end of the string at the same time.
The processing result is converted to a numerical value by a string function and then set to "①Label" on the numeric keypad screen.
3-2-4. Numeric Keypad Clear
Clear the numeric keypad screen by setting 0 to "①Label".
3-2-5. Numeric Keypad Determination
Follow the same logic as in "3-2-2. Numeric Keypad Activation" to set the numeric values on the numeric keypad to the buttons on the main screen and hide the numeric keypad.
3-3. Logic calls from the screen
Set the "3-2-2. Tenkey activation" logic to "① button" on the main screen.
For each button on the numeric keypad screen, set each logic as "processing at the moment of pressing".
This completes the implementation.