src/gui/keyboard/keyboard.c
// Public function for showing the keyboard with config settings
Public function for showing the keyboard with config settings
Public function for showing the keyboard with config settings
void pg_keyboard_show(gslc_tsGui *pGui, int maxLen, char* str, void (*function)(gslc_tsGui *, char *)) {
  touchscreenPageOpen(pGui, E_PG_KEYBOARD);
  pg_keyboard_reset(pGui);
  pg_keyboard_appendCb(pg_keyboard_data, function);
  pg_keyboard_data->limit = maxLen;
  if (pg_keyboard_data->limit > pg_keyboard_data->max) {
    pg_keyboard_data->max = pg_keyboard_data->limit + 10; 
    char *newBuf = (char *)realloc(pg_keyboard_data->ptr, pg_keyboard_data->max * sizeof(char));
    pg_keyboard_data->ptr = newBuf;
  }
  size_t strSz = 1;
  if (str != NULL && strcmp(str, " ") != 0) {
    strSz = snprintf(NULL, 0, "%s", str) + 1;
    if (strSz > pg_keyboard_data->max) {
      strSz = pg_keyboard_data->max;
    }
  }
  strlcpy(pg_keyboard_data->ptr, str, strSz);
  pg_keyboard_data->len = strSz - 2;
  gslc_ElemSetTxtStr(pGui, pg_keyboardEl[E_KEYBOARD_EL_INPUT], pg_keyboard_data->ptr);
  pg_keyboard_limitCheck(pGui);
}
void pg_keyboard_show ( gslc_tsGui * pGui , int maxLen , char * str , void ( * function ) ( gslc_tsGui * , char * ) ) { touchscreenPageOpen ( pGui , E_PG_KEYBOARD ) ; pg_keyboard_reset ( pGui ) ; pg_keyboard_appendCb ( pg_keyboard_data , function ) ; pg_keyboard_data -> limit = maxLen ; if ( pg_keyboard_data -> limit > pg_keyboard_data -> max ) { pg_keyboard_data -> max = pg_keyboard_data -> limit + 10 ; char * newBuf = ( char * ) realloc ( pg_keyboard_data -> ptr , pg_keyboard_data -> max * sizeof ( char ) ) ; pg_keyboard_data -> ptr = newBuf ; } size_t strSz = 1 ; if ( str != NULL && strcmp ( str , " " ) != 0 ) { strSz = snprintf ( NULL , 0 , " " , str ) + 1 ; if ( strSz > pg_keyboard_data -> max ) { strSz = pg_keyboard_data -> max ; } } strlcpy ( pg_keyboard_data -> ptr , str , strSz ) ; pg_keyboard_data -> len = strSz - 2 ; gslc_ElemSetTxtStr ( pGui , pg_keyboardEl [ E_KEYBOARD_EL_INPUT ] , pg_keyboard_data -> ptr ) ; pg_keyboard_limitCheck ( pGui ) ; }
Public function for showing the keyboard with config settings
Public function for showing the keyboard with config settings
// 10 chars Extra past max