Subject | Re: [IBO] Whole Blob field in an IBGrid (Sub_type 1 Text) |
---|---|
Author | Andrew |
Post date | 2003-09-09T13:20:10Z |
Apicito2003 wrote:
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]
>The memo will be of between 4 and 10 text lines (+ -).I wanted something similar but I had complete control of the BLOB
>
> --- 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 ?
>>
>>
>>
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]