Subject Re: [IBO] Whole Blob field in an IBGrid (Sub_type 1 Text)
Author Apicito2003
For if it interests, I have solved this way it:
procedure TSesion.GridAsuGetDisplayText(Sender:
TObject; ACol,
ARow: Integer; var AString: String);
var x,Lineas,Posicion,UltimoBlanco:integer;
begin
x:=1;
Lineas:=0;
Posicion:=1;
UltimoBlanco:=0;
while x<length(AString) do
begin
IF AString[x]=' ' then
UltimoBlanco:=x;
if Astring[x]=#13 then
begin
Posicion:=1;
UltimoBlanco:=0;
inc(Lineas);
end
else if posicion > 60 then
begin
AString[UltimoBlanco]:=#13;
x:=UltimoBlanco+1;
inc(Lineas);
Posicion:=1;
UltimoBlanco:=0;
end;
inc(Posicion);
inc(x);
end;
inc(Lineas);
TDrawGrid(GridAsu).RowHeights[ARow]:=Lineas*19;
end;
--- Andrew <ahaines@...> escribió:
---------------------------------
Apicito2003 wrote:

>The memo will be of between 4 and 10 text lines (+
-).
>
> --- Alan McDonald <alan@...> escribió:
>You can also do your own drawing of the grid and
alter
>the row height
>dependent on the amount of text but there are limits
>to what's sensible as a
>user interface in the grid scenario..
>
>
>>Well, and like I can visualize in a grid the whole
>>memo field ?
>>
>>
>>
I wanted something similar but I had complete control
of the BLOB
contents so I had it easy.
I used the OnGetDisplay of the IB_Grid to set the row
height based on
the number of CR in the blob.

If you do not have control of the BLOB contents then
other solutions may
be better.
Other ideas to get the proper height:
- use the TextWidth function and divide by the column
width.
- Check out how a memo component handles the lines,
word wrapping, etc.

Anyways here is the "very primitive" code I wrote to
do the job:

procedure
TForm_mainsales.IB_Grid6GetDisplayText(Sender:
TObject; ACol,
ARow: Integer; var AString: String);
var
x : Integer;
y : Integer;
begin
if (ACol = 5) then
begin
case ARow of
0:
begin
TDrawGrid(IB_Grid6).RowHeights[ARow] := 17;
end;
else
begin
// count the number of caridge returns in the
memo
if DataModule6.Q_Activity.Active then
begin
y := 0;
for x := 1 to Length(AString) do
begin
if AString[x] = #13 then Y := y + 1;
end;
TDrawGrid(IB_Grid6).RowHeights[ARow] := 17 +
(17 * y);
end
else
begin
TDrawGrid(IB_Grid6).RowHeights[ARow] := 17;
end;
end;
end;
end;
end;

Because the RowHeights property is not pubished you
have to cast it in a
TDrawGrid.



[Non-text portions of this message have been removed]


Yahoo! Groups Sponsor ADVERTISEMENT

___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to
Firebird or InterBase
without the need for BDE, ODBC or any
other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource
for Tech Info papers,
keyword-searchable FAQ, community code contributions
and more !

Your use of Yahoo! Groups is subject to the Yahoo!
Terms of Service.

___________________________________________________
Yahoo! Messenger - Nueva versión GRATIS
Super Webcam, voz, caritas animadas, y más...
http://messenger.yahoo.es