Mercurial > public > ostc4
diff Discovery/Src/tMenuEdit.c @ 1029:e938901f6386 GasConsumption
Text editfield redraw string:
The size of characters may vary from letter to letter. This caused the edit string to be partly overwritten. To avoid this the following ltters are now rewritten in case the current letter is changed.
| author | Ideenmodellierer |
|---|---|
| date | Sun, 07 Sep 2025 20:44:35 +0200 |
| parents | 5fedf7ba2392 |
| children | 2af07aa38531 |
line wrap: on
line diff
--- a/Discovery/Src/tMenuEdit.c Sun Sep 07 19:08:43 2025 +0200 +++ b/Discovery/Src/tMenuEdit.c Sun Sep 07 20:44:35 2025 +0200 @@ -551,7 +551,10 @@ void mark_new_digit_of_actual_id_block_and_subBlock(void) { char oneCharText[2]; + char text[10]; uint16_t positionOffset; + uint8_t index = 0; + uint8_t textPos = 0; if(event[actualevid].callerID != ident[actualId].callerID) return; @@ -563,6 +566,19 @@ positionOffset = GFX_return_offset(ident[actualId].fontUsed, ident[actualId].newText, ident[actualId].begin[block] + subBlockPosition); write_content( ident[actualId].coord[0] + positionOffset, ident[actualId].coord[1], ident[actualId].coord[2], ident[actualId].fontUsed, oneCharText, CLUT_MenuEditDigit); } + if(ident[actualId].maintype == FIELD_TEXT) /* letter width may change from character to character => output end of string */ + { + if(block + 1 < 8) + { + for(index = block + 1; index < 8; index++) + { + text[textPos++] = ident[actualId].newText[ident[actualId].begin[index] + 0]; + } + text[textPos] = 0; + positionOffset = GFX_return_offset(ident[actualId].fontUsed, ident[actualId].newText, ident[actualId].begin[block + 1] + subBlockPosition); + write_content( ident[actualId].coord[0] + positionOffset, ident[actualId].coord[1], ident[actualId].coord[2], ident[actualId].fontUsed, text, CLUT_MenuEditFieldSelected); + } + } }
