gi->height - 2 * border_y);
// gadget text value
- DrawTextBuffer(gi->x + border_x, gi->y + border_y, gi->textarea.value,
- font_nr, gi->textarea.xsize, -1, gi->textarea.ysize, 0,
- BLIT_ON_BACKGROUND, FALSE, FALSE, FALSE);
+ DrawTextArea(gi->x + border_x, gi->y + border_y, gi->textarea.value,
+ font_nr, gi->textarea.xsize, -1, gi->textarea.ysize, 0,
+ BLIT_ON_BACKGROUND, FALSE, FALSE, FALSE);
cursor_letter = gi->textarea.value[gi->textarea.cursor_position];
cursor_string[0] = (cursor_letter != '\0' ? cursor_letter : ' ');
{
int tag = first_tag;
- if (gi == NULL || gi->deactivated)
+ if (gi == NULL)
return;
while (tag != GDI_END)
if (gadget_pressed) // gadget pressed the first time
{
// initialize delay counter
- DelayReached(&pressed_delay, 0);
+ ResetDelayCounter(&pressed_delay);
// start gadget delay with longer delay after first click on gadget
pressed_delay_value = GADGET_FRAME_DELAY_FIRST;
strcpy(text, gi->textinput.value);
strcpy(&gi->textinput.value[cursor_pos], &text[cursor_pos + 1]);
+ DrawGadget(gi, DG_PRESSED, gi->direct_draw);
+ }
+ else if (key == KSYM_Home && cursor_pos > 0)
+ {
+ gi->textinput.cursor_position = 0;
+
+ DrawGadget(gi, DG_PRESSED, gi->direct_draw);
+ }
+ else if (key == KSYM_End && cursor_pos < text_length)
+ {
+ gi->textinput.cursor_position = text_length;
+
DrawGadget(gi, DG_PRESSED, gi->direct_draw);
}
}
int text_length = strlen(gi->textarea.value);
int area_ysize = gi->textarea.ysize;
int cursor_x_pref = gi->textarea.cursor_x_preferred;
+ int cursor_x = gi->textarea.cursor_x;
int cursor_y = gi->textarea.cursor_y;
int cursor_pos = gi->textarea.cursor_position;
char letter = getCharFromKey(key);
strcpy(text, gi->textarea.value);
strcpy(&gi->textarea.value[cursor_pos], &text[cursor_pos + 1]);
+ DrawGadget(gi, DG_PRESSED, gi->direct_draw);
+ }
+ else if (key == KSYM_Home && cursor_x > 0)
+ {
+ setTextAreaCursorPosition(gi, gi->textarea.cursor_position - cursor_x);
+
+ DrawGadget(gi, DG_PRESSED, gi->direct_draw);
+ }
+ else if (key == KSYM_End && cursor_pos < text_length)
+ {
+ int last_cursor_pos = cursor_pos;
+
+ while (gi->textarea.value[cursor_pos] != '\0' &&
+ gi->textarea.value[cursor_pos] != '\n')
+ cursor_pos++;
+
+ setTextAreaCursorPosition(gi, gi->textarea.cursor_position + cursor_pos -
+ last_cursor_pos);
+
DrawGadget(gi, DG_PRESSED, gi->direct_draw);
}
}