RxFPC:RxDBGrid suport options dgDisplayMemoText
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6075 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
5bb1042e9c
commit
e50534cc35
@ -840,6 +840,7 @@ type
|
|||||||
procedure RemoveTools(ATools:TRxDBGridAbstractTools);
|
procedure RemoveTools(ATools:TRxDBGridAbstractTools);
|
||||||
|
|
||||||
procedure OnDataSetScrolled(aDataSet:TDataSet; Distance: Integer);
|
procedure OnDataSetScrolled(aDataSet:TDataSet; Distance: Integer);
|
||||||
|
function GetFieldDisplayText(AField:TField; ACollumn:TRxColumn):string;
|
||||||
protected
|
protected
|
||||||
FRxDbGridLookupComboEditor: TCustomControl;
|
FRxDbGridLookupComboEditor: TCustomControl;
|
||||||
FRxDbGridDateEditor: TWinControl;
|
FRxDbGridDateEditor: TWinControl;
|
||||||
@ -3999,6 +4000,32 @@ begin
|
|||||||
UpdateRowsHeight;
|
UpdateRowsHeight;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TRxDBGrid.GetFieldDisplayText(AField: TField; ACollumn: TRxColumn
|
||||||
|
): string;
|
||||||
|
var
|
||||||
|
J: Integer;
|
||||||
|
begin
|
||||||
|
Result:='';
|
||||||
|
if Assigned(AField) then
|
||||||
|
begin
|
||||||
|
if AField.dataType <> ftBlob then
|
||||||
|
begin
|
||||||
|
if CheckDisplayMemo(AField) then
|
||||||
|
Result := AField.AsString
|
||||||
|
else
|
||||||
|
Result := AField.DisplayText;
|
||||||
|
if Assigned(ACollumn) and (ACollumn.KeyList.Count > 0) and (ACollumn.PickList.Count > 0) then
|
||||||
|
begin
|
||||||
|
J := ACollumn.KeyList.IndexOf(Result);
|
||||||
|
if (J >= 0) and (J < ACollumn.PickList.Count) then
|
||||||
|
Result := ACollumn.PickList[j];
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := FColumnDefValues.FBlobText;
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TRxDBGrid.DefaultDrawCellA(aCol, aRow: integer; aRect: TRect;
|
procedure TRxDBGrid.DefaultDrawCellA(aCol, aRow: integer; aRect: TRect;
|
||||||
aState: TGridDrawState);
|
aState: TGridDrawState);
|
||||||
begin
|
begin
|
||||||
@ -4336,10 +4363,13 @@ begin
|
|||||||
case ColumnEditorStyle(aCol, F) of
|
case ColumnEditorStyle(aCol, F) of
|
||||||
cbsCheckBoxColumn: DrawCheckBoxBitmaps(aCol, aRect, F);
|
cbsCheckBoxColumn: DrawCheckBoxBitmaps(aCol, aRect, F);
|
||||||
else
|
else
|
||||||
if F <> nil then
|
(* if F <> nil then
|
||||||
begin
|
begin
|
||||||
if F.dataType <> ftBlob then
|
if F.dataType <> ftBlob then
|
||||||
begin
|
begin
|
||||||
|
if CheckDisplayMemo(F) then
|
||||||
|
S := F.AsString
|
||||||
|
else
|
||||||
S := F.DisplayText;
|
S := F.DisplayText;
|
||||||
if Assigned(C) and (C.KeyList.Count > 0) and (C.PickList.Count > 0) then
|
if Assigned(C) and (C.KeyList.Count > 0) and (C.PickList.Count > 0) then
|
||||||
begin
|
begin
|
||||||
@ -4352,8 +4382,9 @@ begin
|
|||||||
S := FColumnDefValues.FBlobText;
|
S := FColumnDefValues.FBlobText;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
S := '';
|
S := ''; *)
|
||||||
|
|
||||||
|
S:=GetFieldDisplayText(F, C);
|
||||||
if ((rdgWordWrap in FOptionsRx) and Assigned(C) and (C.WordWrap)) or (FIsMerged) then
|
if ((rdgWordWrap in FOptionsRx) and Assigned(C) and (C.WordWrap)) or (FIsMerged) then
|
||||||
WriteTextHeader(Canvas, aRect, S, C.Alignment)
|
WriteTextHeader(Canvas, aRect, S, C.Alignment)
|
||||||
else
|
else
|
||||||
@ -5390,6 +5421,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
for I := 0 to AColList.Count - 1 do
|
for I := 0 to AColList.Count - 1 do
|
||||||
begin
|
begin
|
||||||
|
(*
|
||||||
if Assigned(TRxColumn(AColList[i]).Field) then
|
if Assigned(TRxColumn(AColList[i]).Field) then
|
||||||
S := TRxColumn(AColList[i]).Field.DisplayText
|
S := TRxColumn(AColList[i]).Field.DisplayText
|
||||||
else
|
else
|
||||||
@ -5400,7 +5432,8 @@ begin
|
|||||||
n := KeyList.IndexOf(S);
|
n := KeyList.IndexOf(S);
|
||||||
if (n <> -1) and (n < PickList.Count) then
|
if (n <> -1) and (n < PickList.Count) then
|
||||||
S := PickList.Strings[n];
|
S := PickList.Strings[n];
|
||||||
end;
|
end; *)
|
||||||
|
S:=GetFieldDisplayText(TRxColumn(AColList[i]).Field, TRxColumn(AColList[i]));
|
||||||
W := Canvas.TextWidth(S) + 6;
|
W := Canvas.TextWidth(S) + 6;
|
||||||
if WA^[i] < W then
|
if WA^[i] < W then
|
||||||
WA^[i] := W;
|
WA^[i] := W;
|
||||||
|
Loading…
Reference in New Issue
Block a user