Skip to main content
Associate II
August 2, 2026
Solved

TouchGFX – Designing a Reusable On-Screen Keyboard Using a Custom Container

  • August 2, 2026
  • 2 replies
  • 63 views

Hello ST Community,

I would like to share an improvement I made to one of my TouchGFX projects.

Background

My previous implementation used a login screen to demonstrate an on-screen keyboard. The login screen was created only as an example application to showcase the keyboard and its functionality.

To provide a more familiar user experience, I also implemented features that are commonly found in modern desktop and web applications, including:

  • Custom on-screen keyboard

  • Password input field

  • Show/Hide Password button

  • Password masking

  • User authentication flow

Although these features worked well for the login example, the keyboard implementation was tightly coupled with the screen.

The Problem

The original custom container included:

  • Keyboard

  • Text area

  • Input buffer

  • Buttons

  • Password controls

Whenever the custom container was added to another screen, all of these UI elements were created together.

This reduced flexibility because many applications only need the keyboard while using their own buttons, labels, and layouts.

New Design

To make the component reusable, I redesigned the architecture.

The custom container now contains only the on-screen keyboard.

Everything else belongs to the screen that is using it.

Each screen creates its own:

  • Text areas

  • Buttons

  • Labels

  • Icons

  • Input buffers

  • Screen-specific logic

The keyboard simply sends key events to the active screen.

Why the Login Screen?

The login screen is only an example used to demonstrate the reusable keyboard.

The keyboard itself is independent of the login screen and can now be integrated into any TouchGFX application without modification.

Example Use Cases

The same keyboard can be reused for:

  • Login and password entry

  • User registration

  • User name input

  • Device configuration

  • Wi-Fi credentials

  • Calibration values

  • System settings

  • Parameter entry

  • Numeric input

  • Any custom form that requires user input

Benefits

  • Reusable keyboard component

  • Separation of keyboard and screen UI

  • Flexible screen design

  • Easier integration into different projects

  • Reduced code duplication

  • Cleaner project architecture

  • Easier maintenance and future expansion

I hope this design approach is useful for other TouchGFX developers. I welcome any feedback or suggestions from the community.

GitHub Repository: https://github.com/dhruvdave4/TouchGFX-Login-System

                                                                                           Custom Keyboard


Login Screen
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Password Visibility Toggle – Visible State
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Password Visibility Toggle – Hidden State

 

Best answer by PeterVang

Hello DhruvDave46,

Thank you very much for sharing your code and experience. To me it sounds like you have found a very good structure to make the keyboard reusable by you and others.

Best regards,

Peter

2 replies

PeterVangBest answer
ST Technical Moderator
August 12, 2026

Hello DhruvDave46,

Thank you very much for sharing your code and experience. To me it sounds like you have found a very good structure to make the keyboard reusable by you and others.

Best regards,

Peter

Associate II
August 12, 2026

Thank you very much, Peter sir , for taking the time to review my project and for your valuable feedback.

I'm glad to hear that the reusable structure can be useful to other TouchGFX developers. My main goal was to separate the keyboard from screen-specific UI so that the same keyboard component can be reused for different input requirements and application screens.

I really appreciate your encouragement and feedback. I will continue improving the component and exploring more reusable TouchGFX UI designs.

Best regards,
Dhruv

ECE Graduate | Aspiring Embedded Systems Engineer STM32 | C/C++ | FreeRTOS | TouchGFX | Embedded Linux Learning • Building • Sharing