Subject | RE: [IBO] GetDisplayText... How does it work? |
---|---|
Author | Thomas Steinmaurer |
Post date | 2004-11-19T16:07:17Z |
Best Regards,
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database and MS SQL Server
Upscene Productions
http://www.upscene.com
following code to show the string '<null>' if the
state of a field is NULL. And additional, if it isn't
NULL, I check whether it is a BLOB field and show the
string '(BLOB...)'.
procedure TfmMainForm.edLoggingGetDisplayText(Sender: TObject; ACol, ARow: Integer; var AString: String);
begin
with TIB_Grid(Sender) do begin
if Assigned(DataSource) and Assigned(DataSource.Dataset) then begin
if DataSource.Dataset.Active and (ARow > 0) and (ACol > 0) then begin
DataSource.Dataset.BufferRowNum := DataRow[ARow];
if (DataSource.Dataset.BufferRowNum > 0) then begin
if DataSource.Dataset.BufferFieldByName(GridFields[ACol - 1].FieldName).IsNull then begin
AString := '<null>';
end else begin
if DataSource.Dataset.BufferFieldByName(GridFields[ACol - 1].FieldName).IsBlob then begin
AString := '(BLOB...)';
end;
end;
end;
end;
end;
end;
end;
There might be another/easier solution, but the above
works for me.
Best Regards,
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database and MS SQL Server
Upscene Productions
http://www.upscene.com
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database and MS SQL Server
Upscene Productions
http://www.upscene.com
> >You need to operate on the Row object to ensure that the timing is correctYou might get the idea with the following. I use the
> >(and, of course, if there is no row, nothing happens, so you don't have to
> >test its cardinality!). The one thing you do need to take care about, is
> >not to cause it to be called when the dataset is not in a Prepared state.
> >
> >procedure TfrmMain.IB_GridBarzeGetDisplayText( Sender: TObject; ACol,
> > ARow: Integer; var AString: string );
> >begin
> > with ARow do begin
> > if ACol = 3 then
> > AString := LeftStr(ByName('TESTO').AsString), 20);
> >end;
> >
> >
> >
> Thanx Helen
>
> But ARow is a Integer :-)
>
> How I Can access to the "Row Object"?
following code to show the string '<null>' if the
state of a field is NULL. And additional, if it isn't
NULL, I check whether it is a BLOB field and show the
string '(BLOB...)'.
procedure TfmMainForm.edLoggingGetDisplayText(Sender: TObject; ACol, ARow: Integer; var AString: String);
begin
with TIB_Grid(Sender) do begin
if Assigned(DataSource) and Assigned(DataSource.Dataset) then begin
if DataSource.Dataset.Active and (ARow > 0) and (ACol > 0) then begin
DataSource.Dataset.BufferRowNum := DataRow[ARow];
if (DataSource.Dataset.BufferRowNum > 0) then begin
if DataSource.Dataset.BufferFieldByName(GridFields[ACol - 1].FieldName).IsNull then begin
AString := '<null>';
end else begin
if DataSource.Dataset.BufferFieldByName(GridFields[ACol - 1].FieldName).IsBlob then begin
AString := '(BLOB...)';
end;
end;
end;
end;
end;
end;
end;
There might be another/easier solution, but the above
works for me.
Best Regards,
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database and MS SQL Server
Upscene Productions
http://www.upscene.com