代码高亮的一处错误
procedure TThsj.CBThsjKeyPress(Sender: TObject; var Key: Char);
begin
if CBThsj.Style = csSimple then
begin
case TField(CBThzd.Items.Objects[CBThzd.ItemIndex]).DataType of
ftSmallint, ftInteger, ftLargeint, ftWord, ftBytes: {整型}
if not (key in ['0'..'9', #8, #3, #22]) then
key := #0;
ftFloat, ftCurrency, ftBCD: {浮点型}
if not (key in ['0'..'9', '.', #8, #3, #22]) then
key := #0
else //这里的高亮匹配不正确,匹配到Case语句上面了
begin
if key = '.' then
begin
if AnsiPos('.', CBThsj.Text) > 0 then
key := #0;
if length(CBThsj.Text) = 0 then
CBThsj.SelText := '0'; {此处必须用SelText属性}
end
end;
ftDate, ftTime, ftDateTime: {日期型}
if not (key in ['0'..'9', '-', #8, #3, #22]) then
key := #0;
end;
end;
end;
|