Hello
In Swedish numeric keyboard is decimalpoint
','
that is problem when inputting float numbers.
i try too override OnKeyPress like this
procedure TForm1.CalcGrid1KeyPress(Sender: TObject; var Key: Char);
var
col, row:integer;
begin
col:=CalcGrid1.Col;
row:=CalcGrid1.Row;
case col of
//
cDiameter,cRevolution,cFeedR,cFeedM,cLength,cPower,
cFeedTime,cAuxTime:if Key=',' then Key:='.';
//
cTurret:begin
Key:=UpCase(Key);
if Key in ['A'..'C', #8]
then CalcGrid1.Cells[col, row]:=AnsiUpperCase(Key)
else Key:=#0;
end;
//
cSpindle:begin
Key:=UpCase(Key);
if Key in ['V', 'H', #8]
then CalcGrid1.Cells[col, row]:=AnsiUpperCase(Key)
else Key:=#0;
end;
//
cExcld:begin
Key:=UpCase(Key);
if Key in ['X'] then
begin
if CalcGrid1.Cells[col, row]=''
then CalcGrid1.Cells[col, row]:='X'
else
begin
CalcGrid1.Cells[col, row]:='';
Key:=#8;
end;
end
else Key:=#0;
end;
end;
CalcSum;
end;
but it do not work every time
i also override OnGetEditorType
procedure TForm1.CalcGrid1GetEditorType(Sender: TObject; ACol, ARow: Integer;
var AEditor: TEditorType);
begin
case ACol of
cOperation,cTurret,cSpindle,cExcld:AEditor:=edNormal;
cSpeed,cPower:AEditor:=edPositiveNumeric;
else AEditor:=edPositiveFloat;
end;
end;
How too solve this problem?
Best Regards
- The Delphi global var DecimalSeparator should contain the operating system value for floating point separator.2) If you set grid.ExcelStyleDecimalSeparator, the OS defined decimal separator will be entered when you press the dot (Del) key on the numeric keypad. It will enter either '.' or ',' depending on your OS settings.3) If you set the editor to any of the types edFloat, edPositiveFloat, ... it will only allow the user to enter via the keyboard the operating system defined decimal separator.
Thank you