TIBCQuery, TDbGrid - Automatically show BLOB SUB_TYPE 1 cont

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
tsteinmaurer
Posts: 52
Joined: Thu 17 Dec 2009 08:25

TIBCQuery, TDbGrid - Automatically show BLOB SUB_TYPE 1 cont

Post by tsteinmaurer » Wed 09 Nov 2011 12:08

Hello,

a TIBCQuery is connected to a TDBGrid. The query component is feed by user-definable SQL statements, which might include BLOB SUB_TYPE 1 columns. Is there an TIBCQuery option to automatically show the BLOB content in the grid instead of "WIDEMEMO"?

Thanks,
Thomas

AndreyZ

Post by AndreyZ » Wed 09 Nov 2011 14:14

Hello,

You can use the OnGetText event handler of your WIDEMEMO fields in the following way:

Code: Select all

procedure TForm1.OnGetText(Sender: TField; var Text: string; DisplayText: Boolean);
begin
  Text := Sender.AsString;
end;

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
  IBCQuery1.Open;
end;

procedure TForm1.IBCQuery1AfterOpen(DataSet: TDataSet);
var
  i: integer;
begin
  for i := 0 to DataSet.FieldCount - 1 do
    if DataSet.Fields[i] is TWideMemoField then
      DataSet.Fields[i].OnGetText := OnGetText;
end;

tsteinmaurer
Posts: 52
Joined: Thu 17 Dec 2009 08:25

Post by tsteinmaurer » Wed 09 Nov 2011 14:32

Thanks!

Post Reply