IDE: fixed crash if ANSI character map didn't contain a valid char values from Dmitry (issue #14189)

git-svn-id: trunk@21089 -
This commit is contained in:
vincents 2009-08-03 14:23:31 +00:00
parent c87a7d7a49
commit 4956fbac7b

View File

@ -161,7 +161,7 @@ begin
if (Button = mbLeft) and (StringGrid1.MouseToGridZone(X, Y) = gzNormal) then if (Button = mbLeft) and (StringGrid1.MouseToGridZone(X, Y) = gzNormal) then
begin begin
StringGrid1.MouseToCell(X, Y, Col, Row); StringGrid1.MouseToCell(X, Y, Col, Row);
if Assigned(OnInsertCharacter) then if (StringGrid1.Cells[Col, Row] <> '') and (Assigned(OnInsertCharacter)) then
OnInsertCharacter(StringGrid1.Cells[Col, Row]); OnInsertCharacter(StringGrid1.Cells[Col, Row]);
end; end;
end; end;
@ -176,10 +176,15 @@ begin
begin begin
StringGrid1.MouseToCell(X, Y, Col, Row); StringGrid1.MouseToCell(X, Y, Col, Row);
if StringGrid1.Cells[Col, Row] <> '' then
begin
CharOrd := Ord(UTF8ToAnsi(StringGrid1.Cells[Col, Row])[1]); CharOrd := Ord(UTF8ToAnsi(StringGrid1.Cells[Col, Row])[1]);
CharInfoLabel.Caption := 'Decimal = ' + IntToStr(CharOrd) + CharInfoLabel.Caption := 'Decimal = ' + IntToStr(CharOrd) +
', Hex = $' + HexStr(CharOrd, 2); ', Hex = $' + HexStr(CharOrd, 2);
end end
else
CharInfoLabel.Caption := '-';
end
else else
begin begin
CharInfoLabel.Caption := '-'; CharInfoLabel.Caption := '-';