c. Alphanumeric Keyboard Input

<< Click to Display Table of Contents >>

Navigation:  Tutorials > Tutorial 14 - CleO Utility Widgets >

c. Alphanumeric Keyboard Input

This tutorial shows how to use the Alphanumeric Keyboard widget.The Keyboard() widget can be used to invoke the keyboard on the screen. You are required to pass text field which will store the text typed using the keyboard.



Command Prototype


uint16_t Keyboard(const char* Prompt,  textfield &AlphaNumeric);





text displayed on top of the widget screen


text field which contains text input from keyboard






void setup()


/* Max allowed input length is 16 */

 textfield AlphaNumeric = { 16, "" };


/* Initialize CleO - needs to be done only once */



/* Draw Keypad */

 char buf[20];

 sprintf(buf, "Keyboard - %d chars", AlphaNumeric.size);

 int16_t retcode = CleO.Keyboard(buf, AlphaNumeric);

 if (retcode == 1) // Cancel pressed

   strcpy(AlphaNumeric.text, ""); // erase text


/* Start building a screen frame */



 CleO.StringExt(FONT_MEDIUM, 160, 240, LIGHT_GREEN, MM, 0, 0,



/* Display completed screen frame */




void loop() { }





In the above code snippet, the struct shows the definition of the text field.

The Keyboard() command illustrates how to draw a text retrieved from the keyboard.


Note: Make sure to perform the screen calibration. For details, refer to Tutorial 19 - Miscellaneous Commands > a. Screen Calibration.





Here is the output displayed upon executing the code snippet -