Subject | Re: [IBO] GetDisplayText... How does it work? |
---|---|
Author | Helen Borrie |
Post date | 2004-11-19T13:43:17Z |
At 02:09 PM 19/11/2004 +0100, you wrote:
(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;
Helen
>Hi all,You need to operate on the Row object to ensure that the timing is correct
>
>In my app. I want display first 20 chars of my Blob-text field
>So in GetDisplayText in a TIB_Grid I wrote follow
>
>procedure TfrmMain.IB_GridBarzeGetDisplayText( Sender: TObject; ACol,
> ARow: Integer; var AString: string );
>begin
> if ( ACol = 3 ) and ( ARow > 0 ) then
> AString := LeftStr( qryBarze.FieldByName( 'TESTO' ).AsString, 20 );
>end;
>
>The problem is that qryBarze seems not synchronized whit grids row.
>
>In every row there is first 20 char of the *last* record of TIB_Query.
>So every row is the same (When click on Grid, selected row display
>correct text, the other not)
>
>Why?
(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;
Helen