Hello, The stringgrid editor does the following:
procedure TStringCellEditor.Change; begin inherited Change; if FGrid<>nil then begin FGrid.SetEditText(FCol, FRow, Text); end; end; procedure TStringCellEditor.EditingDone; begin inherited EditingDone; if FGrid<>nil then FGrid.EditingDone; end; This makes it completely impossible to do any checking of the entered values, because the SetEditText() event has no way of knowing when the editing ends. In my opinion, the SetEditText() should only be called when the editing is done, i.e. it should be like this: procedure TStringCellEditor.Change; begin inherited Change; end; procedure TStringCellEditor.EditingDone; begin inherited EditingDone; if FGrid<>nil then begin FGrid.SetEditText(FCol, FRow, Text); FGrid.EditingDone; end; end; Imagine a stringgrid where you want to allow only real numbers in a cell. In that case you normally do 2 things: - Only allow numerals and decimal points in the OnKeyPress event - Only save the edit text when a valid number is entered, and give an error message if it is not valid. With the current situation, this is simply impossible, because of the following: 1. User types 1 -> Settext receives 1 -> all is well. 2. User types . -> settext received 1. -> error, because 1. is not a valid number. In other words, there is no way of knowing when you have received the final text that the user has entered. Is there a reason for the current behaviour, and can it be changed ? Michael. _______________________________________________ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus