BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Memo fields in TDBGrid

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases
View previous topic :: View next topic  
Author Message
Mike Zmuda
Guest





PostPosted: Fri Sep 08, 2006 2:56 am    Post subject: Memo fields in TDBGrid Reply with quote



Hello,

Does anybody know how to get a TDBGrid to display Memo fields from a database?

I've tried doing things with the DrawDataCell event, but it doesn't even
trigger.

procedure TForm1.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
Var
P : Array[0..50] of Char;
BS : tBlobStream;
S : String;
begin
S := '';
If Field is TMemoField then Begin
With (Sender as TDBGrid).Canvas do Begin
BS := tBlobStream.create(TBlobField(Field),bmRead);
FillChar(P,SizeOf(P),#0);
BS.Read(P,50);
BS.Free;
S := StrPas(P);
While Pos(#13,S) > 0 do S[POS(#13,S)] := ' ';
While Pos(#10,S) > 0 do S[Pos(#10,S)] := ' ';
FillRect(Rect);
TextOut(Rect.Left,Rect.Top,S);
end;
end;
end;

What am I doing wrong / is there an easier way to get the TDBGrid to display a
memo field?

(Specifically, I'm not looking for another component to display memo fields - I
have those. I'm looking to see the specific memo using the default TDBGrid
component that ships with Delphi 2006.)

Thanks -

Mike Z.
Back to top
Riki Wiki
Guest





PostPosted: Fri Sep 08, 2006 7:42 am    Post subject: Re: Memo fields in TDBGrid Reply with quote



Hoi Mike

You need to repost your question on the Borland news server to make
everybody see it and possibly answer your question. Further, this news
group do not officially exist, the group to use is b.p.d.database.general.

How to post to Delphi newsgroups:
<http://delphi.wikia.com/wiki/Delphi_Newsgroups>
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.