-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request: Create keypad element #5
Comments
XKeyPad components have now been developed in a local branch and undergoing final testing. The initial code was based on great contributions by @Pconti31 .
Effort was put into making a base XKeyPad element type that can be easily extended by the user to create their own data entry controls. The Num & Alpha are example variants that extend/derive from the XKeyPad base functionality, but it should be straightforward to create one's own. Example usage for numeric input // Configure keypad options
gslc_tsXKeyPadCfg sCfg = gslc_ElemXKeyPadCfgInit_Num();
gslc_ElemXKeyPadCfgSetFloatEn(&sCfg, true);
gslc_ElemXKeyPadCfgSetButtonSz(&sCfg, 25, 25);
// Create keypad
pElemRef = gslc_ElemXKeyPadCreate_Num(&m_gui, E_ELEM_KEYPAD, E_PG_POPUP,
&m_sXKeyPad, 20, 50, E_FONT_SANS1, &sCfg);
// Optionally register a callback function from the keypad
gslc_ElemXKeyPadSetCb(&m_gui, pElemRef, &CbInputKeyPad); Example as a popupThe keypad can be used as a popup dialog, in which case the return value can be fetched from the callback: // Show the popup
gslc_PopupShow(&m_gui, E_PG_POPUP, true); // Show the popup "page" containing the keypad
...
// Upon the callback from the KeyPad:
case XKEYPAD_CB_STATE_DONE:
GSLC_DEBUG_PRINT("KeyPad returned value [%s]\n", (char*)pvData);
gslc_PopupHide(&m_gui);
break; Implementation NotesThis first version of the XKeyPad has not been optimized for memory consumption. In particular, it does not yet leverage PROGMEM / Flash memory for keypad label storage. In addition, it utilizes compound elements, which can place moderate demands on memory for larger keypads. A revised XKeyPad will create a simple element that handles its own custom redraw and touch handling (w/o compound elements), enabling far more memory efficiency. |
XKeyPad is now available for testing in the WIP005-XKeyPad branch. Example Outstanding edits:
|
XKeyPad component merged and now available from master Examples added:
Outstanding feature development will continue on this component as noted earlier. |
Build a keypad element. For flexibility in supporting custom button appearance by users, it may be easiest to use the compound element definition (simple example in
XSelNum
).Probably want to support a couple variants:
Ideally, we would have a textarea, a set of input keys plus a Save and Cancel button.
To keep things simple, the textarea can be static and not accept touch presses itself.
Enhancements:
The text was updated successfully, but these errors were encountered: