summaryrefslogtreecommitdiff
path: root/src/widget_textfield.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/widget_textfield.c')
-rw-r--r--src/widget_textfield.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/widget_textfield.c b/src/widget_textfield.c
index 67138fb..99b861c 100644
--- a/src/widget_textfield.c
+++ b/src/widget_textfield.c
@@ -109,6 +109,11 @@ static void readKey(widget_textfield_t *p)
return;
}
+ if( p->w > WIDGET_TEXTFIELD_WIDTH-40 )
+ {
+ return;
+ }
+
//klavesy abecedy
for(i=SDLK_SPACE /*SDLK_a*/;i<=SDLK_z;i++)
{
@@ -118,11 +123,13 @@ static void readKey(widget_textfield_t *p)
p->time = WIDGET_TEXTFIELD_TIME_READ_KEY;
strcat( p->text, SDL_GetKeyName(i) );
+ getTextSize(p->text, &p->w, &p->h);
if( mapa[SDLK_LSHIFT] == SDL_PRESSED ||
mapa[SDLK_RSHIFT] == SDL_PRESSED)
{
p->text[ strlen( p->text ) - 1 ] -= 32;
+ getTextSize(p->text, &p->w, &p->h);
return;
}
}
@@ -135,6 +142,7 @@ static void readKey(widget_textfield_t *p)
{
p->time = WIDGET_TEXTFIELD_TIME_READ_KEY;
strcat( p->text, SDL_GetKeyName(i) );
+ getTextSize(p->text, &p->w, &p->h);
return;
}
}
@@ -146,6 +154,7 @@ static void readKey(widget_textfield_t *p)
{
p->time = WIDGET_TEXTFIELD_TIME_READ_KEY;
strncat( p->text, SDL_GetKeyName(i)+1, 1 ); // napr. "[4]"
+ getTextSize(p->text, &p->w, &p->h);
return;
}
}