Discussion:
Displaying BLOB field in DBGrid
(too old to reply)
Sugiharto
2003-07-31 01:05:07 UTC
Permalink
I have some BLOB fields in my database. When I display them in a DBGrid,
they showed as MEMO instead of their real value (text/graphic).
Is it possible to show BLOB fields value in DBGrid?

Sugiharto
Jeff Overcash (TeamB)
2003-07-31 13:15:56 UTC
Permalink
Post by Sugiharto
I have some BLOB fields in my database. When I display them in a DBGrid,
they showed as MEMO instead of their real value (text/graphic).
Is it possible to show BLOB fields value in DBGrid?
No. Some third party grids will do this (both InfoPower and DevExpress) but the
standard DBGrid will not.
Post by Sugiharto
Sugiharto
--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
If there is somebody up there could they throw me down a line. Just a
little helping hand just a little understanding. Just some answers to the
questions that surround me now. If there's somebody up there could
they throw me down a line. (Fish)
Wayne Niddery [TeamB]
2003-07-31 18:46:29 UTC
Permalink
Post by Sugiharto
I have some BLOB fields in my database. When I display them in a
DBGrid, they showed as MEMO instead of their real value
(text/graphic).
Is it possible to show BLOB fields value in DBGrid?
You can use the OnGetText event of the memo field to set the displayed text
to the memo contents, but of course you have to contend with the limited
room in the grid cell.
--
Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com)
RADBooks: http://www.logicfundamentals.com/RADBooks.html
"It is error alone which needs the support of government. Truth can
stand by itself." - Thomas Jefferson
Sugiharto
2003-07-31 23:46:59 UTC
Permalink
Where is the OnGetText event? I can't find it, is it part of the grid or
somewhere else?
Post by Wayne Niddery [TeamB]
You can use the OnGetText event of the memo field to set the displayed text
to the memo contents, but of course you have to contend with the limited
room in the grid cell.
Jeff Overcash (TeamB)
2003-08-01 00:07:49 UTC
Permalink
Post by Sugiharto
Where is the OnGetText event? I can't find it, is it part of the grid or
somewhere else?
Persist the TFields. It is a TField event.
--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
If there is somebody up there could they throw me down a line. Just a
little helping hand just a little understanding. Just some answers to the
questions that surround me now. If there's somebody up there could
they throw me down a line. (Fish)
Sugiharto
2003-08-01 00:15:09 UTC
Permalink
I found it, under the FieldByName(X).OnGetText, but I can't understand how
to use it, can you explain a little?
I read the help but still don't understand.
Post by Wayne Niddery [TeamB]
Post by Sugiharto
I have some BLOB fields in my database. When I display them in a
DBGrid, they showed as MEMO instead of their real value
(text/graphic).
Is it possible to show BLOB fields value in DBGrid?
You can use the OnGetText event of the memo field to set the displayed text
to the memo contents, but of course you have to contend with the limited
room in the grid cell.
--
Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com)
RADBooks: http://www.logicfundamentals.com/RADBooks.html
"It is error alone which needs the support of government. Truth can
stand by itself." - Thomas Jefferson
Wayne Niddery [TeamB]
2003-08-01 23:05:06 UTC
Permalink
Post by Sugiharto
I found it, under the FieldByName(X).OnGetText, but I can't
understand how to use it, can you explain a little?
I read the help but still don't understand.
procedure MyForm.MyTableSomeMemoGetText(Sender: TField;
var Text: String; DisplayText: Boolean);
begin
Text := Sender.AsString;
end;

Create the OnGetText event for the memo field. The single line of code above
should work there.
--
Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com)
RADBooks: http://www.logicfundamentals.com/RADBooks.html
"It is error alone which needs the support of government. Truth can
stand by itself." - Thomas Jefferson
Nestor
2003-08-02 02:30:41 UTC
Permalink
Hi :

You may try a third party grid like TJfDBGrid of JfControls at
www.jfactivesoft.com. But if ypu want to do this by your own:
- Load the Blob field into a TMemoryStream.
- Use the VCL TIMage and draw it inside the cell. There is an OnDrawCell
event or something like that. The image will appear small.
- Use any mouse event to catch a click, and show another TImage. Use the
memory stream to do that.

Anyway, if you are a newbie, I advice you to use a third party solution like
JfControl.

Best regards...

Nestor
Post by Sugiharto
I have some BLOB fields in my database. When I display them in a DBGrid,
they showed as MEMO instead of their real value (text/graphic).
Is it possible to show BLOB fields value in DBGrid?
Sugiharto
Loading...