mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-07 11:16:07 +02:00
LCL, dbgrids: dgDisplayMemoText allows field editing too.
git-svn-id: trunk@56469 -
This commit is contained in:
parent
7278c5ac87
commit
39553de54e
@ -392,6 +392,7 @@ type
|
|||||||
procedure BeforeMoveSelection(const DCol,DRow: Integer); override;
|
procedure BeforeMoveSelection(const DCol,DRow: Integer); override;
|
||||||
procedure BeginLayout;
|
procedure BeginLayout;
|
||||||
procedure CellClick(const aCol,aRow: Integer; const Button:TMouseButton); override;
|
procedure CellClick(const aCol,aRow: Integer; const Button:TMouseButton); override;
|
||||||
|
function CheckDisplayMemo(aField: TField): boolean;
|
||||||
procedure InvalidateSizes;
|
procedure InvalidateSizes;
|
||||||
procedure ColRowMoved(IsColumn: Boolean; FromIndex,ToIndex: Integer); override;
|
procedure ColRowMoved(IsColumn: Boolean; FromIndex,ToIndex: Integer); override;
|
||||||
function ColumnEditorStyle(aCol: Integer; F: TField): TColumnButtonStyle;
|
function ColumnEditorStyle(aCol: Integer; F: TField): TColumnButtonStyle;
|
||||||
@ -1559,6 +1560,9 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
F := GetFieldFromGridColumn(ACol);
|
F := GetFieldFromGridColumn(ACol);
|
||||||
if (F <> nil) then
|
if (F <> nil) then
|
||||||
|
if CheckDisplayMemo(f) then
|
||||||
|
result := F.AsString
|
||||||
|
else
|
||||||
if (F.DataType <> ftBlob) then
|
if (F.DataType <> ftBlob) then
|
||||||
Result := F.DisplayText
|
Result := F.DisplayText
|
||||||
else
|
else
|
||||||
@ -2120,7 +2124,7 @@ begin
|
|||||||
{$ifdef dbgGridPaint}
|
{$ifdef dbgGridPaint}
|
||||||
DbgOut(' Field=%s',[F.FieldName]);
|
DbgOut(' Field=%s',[F.FieldName]);
|
||||||
{$endif}
|
{$endif}
|
||||||
if (F.DataType=ftMemo) and (dgDisplayMemoText in Options) then
|
if CheckDisplayMemo(F) then
|
||||||
S := F.AsString
|
S := F.AsString
|
||||||
else
|
else
|
||||||
S := F.DisplayText;
|
S := F.DisplayText;
|
||||||
@ -2888,6 +2892,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomDBGrid.CheckDisplayMemo(aField: TField): boolean;
|
||||||
|
begin
|
||||||
|
// note that this assumes that aField is not nil
|
||||||
|
result := (aField.DataType=ftMemo) and (dgDisplayMemoText in Options);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomDBGrid.EndLayout;
|
procedure TCustomDBGrid.EndLayout;
|
||||||
begin
|
begin
|
||||||
dec(FLayoutChangedCount);
|
dec(FLayoutChangedCount);
|
||||||
@ -2998,10 +3008,14 @@ begin
|
|||||||
Result := '';
|
Result := '';
|
||||||
if FDataLink.Active then begin
|
if FDataLink.Active then begin
|
||||||
aField := GetFieldFromGridColumn(aCol);
|
aField := GetFieldFromGridColumn(aCol);
|
||||||
if aField<>nil then
|
if aField<>nil then begin
|
||||||
|
if CheckDisplayMemo(aField) then
|
||||||
|
Result := aField.AsString
|
||||||
|
else
|
||||||
Result := aField.Text;
|
Result := aField.Text;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TCustomDBGrid.GetIsCellSelected(aCol, aRow: Integer): boolean;
|
function TCustomDBGrid.GetIsCellSelected(aCol, aRow: Integer): boolean;
|
||||||
begin
|
begin
|
||||||
@ -3251,13 +3265,19 @@ procedure TCustomDBGrid.DrawColumnText(aCol, aRow: Integer; aRect: TRect;
|
|||||||
aState: TGridDrawState);
|
aState: TGridDrawState);
|
||||||
var
|
var
|
||||||
F: TField;
|
F: TField;
|
||||||
|
s: String;
|
||||||
begin
|
begin
|
||||||
if GetIsCellTitle(aCol, aRow) then
|
if GetIsCellTitle(aCol, aRow) then
|
||||||
inherited DrawColumnText(aCol, aRow, aRect, aState)
|
inherited DrawColumnText(aCol, aRow, aRect, aState)
|
||||||
else begin
|
else begin
|
||||||
F := GetFieldFromGridColumn(aCol);
|
F := GetFieldFromGridColumn(aCol);
|
||||||
if F<>nil then
|
if F<>nil then begin
|
||||||
DrawCellText(aCol, aRow, aRect, aState, F.DisplayText)
|
if CheckDisplayMemo(F) then
|
||||||
|
s := F.AsString
|
||||||
|
else
|
||||||
|
s := F.DisplayText;
|
||||||
|
DrawCellText(aCol, aRow, aRect, aState, s)
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3346,7 +3366,8 @@ begin
|
|||||||
aField := SelectedField;
|
aField := SelectedField;
|
||||||
if aField<>nil then begin
|
if aField<>nil then begin
|
||||||
Result := IsValidChar(AField, Ch) and not aField.Calculated and
|
Result := IsValidChar(AField, Ch) and not aField.Calculated and
|
||||||
(aField.DataType<>ftAutoInc) and (aField.FieldKind<>fkLookup) and not aField.IsBlob;
|
(aField.DataType<>ftAutoInc) and (aField.FieldKind<>fkLookup) and
|
||||||
|
(not aField.IsBlob or CheckDisplayMemo(aField));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -3609,6 +3630,9 @@ begin
|
|||||||
|
|
||||||
else begin
|
else begin
|
||||||
if F<>nil then begin
|
if F<>nil then begin
|
||||||
|
if CheckDisplayMemo(F) then
|
||||||
|
S := F.AsString
|
||||||
|
else
|
||||||
if F.dataType <> ftBlob then
|
if F.dataType <> ftBlob then
|
||||||
S := F.DisplayText
|
S := F.DisplayText
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user