Memo field in DBGrid 
Author Message
 Memo field in DBGrid

Hi!

In delphi 1.0, how can I display the contents (or only the first 20-30
characters) of a memo field?

Thanks
SzG



Mon, 28 Dec 1998 03:00:00 GMT  
 Memo field in DBGrid



 sg> In Delphi 1.0, how can I display the contents (or only the first 20-30
 sg>  characters) of a memo field?

How about using a calculated string field and getting those 20 chars in
onCalcFields ?

Just an idea.

Henk



Mon, 28 Dec 1998 03:00:00 GMT  
 Memo field in DBGrid

Hi, i use the OnDrawDataCell-Event :

procedure TMainForm.DBGrid1DrawDataCell(Sender: TObject;
                                        const Rect: TRect;
                                        Field: TField;
                                        State: TGridDrawState);
const
  iDisplayWidht = 35;             {  How many Chars from Memo-Field ? }
var
  szTxt  : array[0..iDisplayWidht] of Char;
  aBS    : TBlobStream;
  sTxt   : String[iDisplayWidht];
begin
  if Field is TMemoField then
  begin
    { MainTableFieldName is a TField }
    aBS := TBlobStream.Create(MainTableFieldName, bmRead);
    FillChar(szTxt, SizeOf(szTxt), #0);
    try
      aBS.Read(szTxt, iDisplayWidht);
    finally
      aBS.Free
    end;
    sTxt := StrPas(szTxt);
    with (Sender as TDBGrid).Canvas do
    begin
      FillRect(Rect);
      TextOut(Rect.Left, Rect.Top, sTxt + '...')
    end
  end
end;

That's all.

Regards

Andy



Thu, 31 Dec 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Memo field in DBGrid

2. How to display memo fields on DBGrids?

3. Memo Fields in DBGRID

4. Memo field in DBGrid

5. Another DBGrid question about Memo fields

6. DBGrid with multi-line memo field extension

7. What is the syntax for copy a memo to a database memo field

8. Memo Field to Database field

9. Copy data from string field to memo field

10. Storing Memo fields in Databases (Blob Fields?)

11. Help: DBMemo in character-field (not Memo-field)

12. Help: copy memo field from one table to another field

 

 
Powered by phpBB® Forum Software