LCL, grid improvement (inplace editing of cell values with picklisteditor and stringeditor), from Oleg, issue #15833

git-svn-id: trunk@27317 -
This commit is contained in:
jesus 2010-09-11 22:44:28 +00:00
parent 05a65583d1
commit 90bf8f4f5e

View File

@ -226,6 +226,7 @@ type
procedure DropDown; override;
procedure CloseUp; override;
procedure Select; override;
procedure Change; override;
procedure msg_GetValue(var Msg: TGridMessage); message GM_GETVALUE;
procedure msg_SetGrid(var Msg: TGridMessage); message GM_SETGRID;
procedure msg_SetValue(var Msg: TGridMessage); message GM_SETVALUE;
@ -9528,12 +9529,14 @@ end;
procedure TCustomStringGrid.SetEditText(aCol, aRow: Longint; const aValue: string);
begin
GridFlags := GridFlags + [gfEditorUpdateLock];
try
if Cells[aCol, aRow]<>aValue then
Cells[aCol, aRow]:= aValue;
finally
GridFlags := GridFlags - [gfEditorUpdateLock];
if not EditorIsReadOnly then begin
GridFlags := GridFlags + [gfEditorUpdateLock];
try
if Cells[aCol, aRow]<>aValue then
Cells[aCol, aRow]:= aValue;
finally
GridFlags := GridFlags - [gfEditorUpdateLock];
end;
end;
inherited SetEditText(aCol, aRow, aValue);
end;
@ -10746,14 +10749,20 @@ end;
procedure TPickListCellEditor.Select;
begin
if FGrid<>nil then begin
if FGrid.EditorIsReadOnly then
exit;
FGrid.SetEditText(FCol, FRow, Text);
FGrid.PickListItemSelected(Self);
end;
inherited Select;
end;
procedure TPickListCellEditor.Change;
begin
if FGrid<>nil then begin
FGrid.SetEditText(FCol, FRow, Text);
end;
inherited Change;
end;
procedure TPickListCellEditor.msg_GetValue(var Msg: TGridMessage);
begin
Msg.Col := FCol;