Forum > CustomDrawn

[SOLVED] TEdit key press events in customdrawn LCLWidgetType

<< < (3/3)

AlexTP:
>Also why casting a word to byte?

E.g. russian char will be Word with high bits set, and you cast it to Byte?

dsiders:

--- Quote from: AlexTP on April 21, 2023, 05:41:02 pm --->Also why casting a word to byte?

E.g. russian char will be Word with high bits set, and you cast it to Byte?

--- End quote ---

Let's summarize...

Patches on forum instead of bug tracker (check).
No test case (check).
Submitted as a patch to bug tracker (check).
Patch applied without testing (check).

Given all of that... what could possibly go wrong?

lagprogramming:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.Button1Click(Sender: TObject);//add lcltype to usesvar  AChar: TUTF8Char;begin  AChar:='Њ';//Cyrillic capital letter nje  Application.MainForm.Caption:=inttostr(length(AChar));  //Now the caption of the form will be "2" IT'S 2, NOT 1!  AChar:='x';  Application.MainForm.Caption:=Application.MainForm.Caption+inttostr(length(AChar));  //Now the caption of the form will become "21"  //Notice that the length is 2 the first time and the second time the length is 1end;  Regarding the patch, I don't see a new bug inserted in the code by modifying "if Length(AChar) = 1 then lCharCode := Word(AChar[1])" with "if Length(AChar) = 1 then lCharCode := Byte(AChar[1])". Knowing that the significant data of AChar is one byte size there is no need to try to read two bytes(word type).
https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40221 can be closed.

Navigation

[0] Message Index

[*] Previous page

Go to full version