Do not draw 'Clear' button for EditText field, this cause crash in Town Directory
This commit is contained in:
@@ -816,6 +816,7 @@ void QueryString::DrawEditBox(const Window *w, int wid) const
|
|||||||
bool rtl = _current_text_dir == TD_RTL;
|
bool rtl = _current_text_dir == TD_RTL;
|
||||||
Dimension sprite_size = GetSpriteSize(rtl ? SPR_IMG_DELETE_RIGHT : SPR_IMG_DELETE_LEFT);
|
Dimension sprite_size = GetSpriteSize(rtl ? SPR_IMG_DELETE_RIGHT : SPR_IMG_DELETE_LEFT);
|
||||||
int clearbtn_width = GetMinSizing(NWST_BUTTON, sprite_size.width + WD_IMGBTN_LEFT + WD_IMGBTN_RIGHT);
|
int clearbtn_width = GetMinSizing(NWST_BUTTON, sprite_size.width + WD_IMGBTN_LEFT + WD_IMGBTN_RIGHT);
|
||||||
|
clearbtn_width = 0; // Touch interface has it's own keyboard input, and it won't leave space for edit field
|
||||||
|
|
||||||
int clearbtn_left = wi->pos_x + (rtl ? 0 : wi->current_x - clearbtn_width);
|
int clearbtn_left = wi->pos_x + (rtl ? 0 : wi->current_x - clearbtn_width);
|
||||||
int clearbtn_right = wi->pos_x + (rtl ? clearbtn_width : wi->current_x) - 1;
|
int clearbtn_right = wi->pos_x + (rtl ? clearbtn_width : wi->current_x) - 1;
|
||||||
@@ -825,9 +826,11 @@ void QueryString::DrawEditBox(const Window *w, int wid) const
|
|||||||
int top = wi->pos_y;
|
int top = wi->pos_y;
|
||||||
int bottom = wi->pos_y + wi->current_y - 1;
|
int bottom = wi->pos_y + wi->current_y - 1;
|
||||||
|
|
||||||
DrawFrameRect(clearbtn_left, top, clearbtn_right, bottom, wi->colour, wi->IsLowered() ? FR_LOWERED : FR_NONE);
|
if (clearbtn_width > 0) {
|
||||||
DrawSprite(rtl ? SPR_IMG_DELETE_RIGHT : SPR_IMG_DELETE_LEFT, PAL_NONE, Center(clearbtn_left + wi->IsLowered(), clearbtn_width, sprite_size.width), Center(top + wi->IsLowered(), bottom - top, sprite_size.height));
|
DrawFrameRect(clearbtn_left, top, clearbtn_right, bottom, wi->colour, wi->IsLowered() ? FR_LOWERED : FR_NONE);
|
||||||
if (this->text.bytes == 1) GfxFillRect(clearbtn_left + 1, top + 1, clearbtn_right - 1, bottom - 1, _colour_gradient[wi->colour & 0xF][2], FILLRECT_CHECKER);
|
DrawSprite(rtl ? SPR_IMG_DELETE_RIGHT : SPR_IMG_DELETE_LEFT, PAL_NONE, Center(clearbtn_left + wi->IsLowered(), clearbtn_width, sprite_size.width), Center(top + wi->IsLowered(), bottom - top, sprite_size.height));
|
||||||
|
if (this->text.bytes == 1) GfxFillRect(clearbtn_left + 1, top + 1, clearbtn_right - 1, bottom - 1, _colour_gradient[wi->colour & 0xF][2], FILLRECT_CHECKER);
|
||||||
|
}
|
||||||
|
|
||||||
DrawFrameRect(left, top, right, bottom, wi->colour, FR_LOWERED | FR_DARKENED);
|
DrawFrameRect(left, top, right, bottom, wi->colour, FR_LOWERED | FR_DARKENED);
|
||||||
GfxFillRect(left + 1, top + 1, right - 1, bottom - 1, PC_BLACK);
|
GfxFillRect(left + 1, top + 1, right - 1, bottom - 1, PC_BLACK);
|
||||||
|
|||||||
Reference in New Issue
Block a user