Page 1 of 1

TIBCQuery, TDbGrid - Automatically show BLOB SUB_TYPE 1 cont

Posted: Wed 09 Nov 2011 12:08
by tsteinmaurer
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

Posted: Wed 09 Nov 2011 14:14
by AndreyZ
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;

Posted: Wed 09 Nov 2011 14:32
by tsteinmaurer
Thanks!