comparison 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
comparison
equal deleted inserted replaced
1028:3d9552e4997c 1029:e938901f6386
549 549
550 550
551 void mark_new_digit_of_actual_id_block_and_subBlock(void) 551 void mark_new_digit_of_actual_id_block_and_subBlock(void)
552 { 552 {
553 char oneCharText[2]; 553 char oneCharText[2];
554 char text[10];
554 uint16_t positionOffset; 555 uint16_t positionOffset;
556 uint8_t index = 0;
557 uint8_t textPos = 0;
555 558
556 if(event[actualevid].callerID != ident[actualId].callerID) 559 if(event[actualevid].callerID != ident[actualId].callerID)
557 return; 560 return;
558 561
559 if((ident[actualId].maintype == FIELD_NUMBERS) || (ident[actualId].maintype == FIELD_TEXT)) 562 if((ident[actualId].maintype == FIELD_NUMBERS) || (ident[actualId].maintype == FIELD_TEXT))
560 { 563 {
561 oneCharText[0] = ident[actualId].newText[ident[actualId].begin[block] + subBlockPosition]; 564 oneCharText[0] = ident[actualId].newText[ident[actualId].begin[block] + subBlockPosition];
562 oneCharText[1] = 0; 565 oneCharText[1] = 0;
563 positionOffset = GFX_return_offset(ident[actualId].fontUsed, ident[actualId].newText, ident[actualId].begin[block] + subBlockPosition); 566 positionOffset = GFX_return_offset(ident[actualId].fontUsed, ident[actualId].newText, ident[actualId].begin[block] + subBlockPosition);
564 write_content( ident[actualId].coord[0] + positionOffset, ident[actualId].coord[1], ident[actualId].coord[2], ident[actualId].fontUsed, oneCharText, CLUT_MenuEditDigit); 567 write_content( ident[actualId].coord[0] + positionOffset, ident[actualId].coord[1], ident[actualId].coord[2], ident[actualId].fontUsed, oneCharText, CLUT_MenuEditDigit);
568 }
569 if(ident[actualId].maintype == FIELD_TEXT) /* letter width may change from character to character => output end of string */
570 {
571 if(block + 1 < 8)
572 {
573 for(index = block + 1; index < 8; index++)
574 {
575 text[textPos++] = ident[actualId].newText[ident[actualId].begin[index] + 0];
576 }
577 text[textPos] = 0;
578 positionOffset = GFX_return_offset(ident[actualId].fontUsed, ident[actualId].newText, ident[actualId].begin[block + 1] + subBlockPosition);
579 write_content( ident[actualId].coord[0] + positionOffset, ident[actualId].coord[1], ident[actualId].coord[2], ident[actualId].fontUsed, text, CLUT_MenuEditFieldSelected);
580 }
565 } 581 }
566 } 582 }
567 583
568 584
569 void enterMenuEditField(void) 585 void enterMenuEditField(void)