Subject | Re: [IBO] Re: Is TIB_Grid broken? |
---|---|
Author | Geoff Worboys |
Post date | 2010-03-30T22:56:35Z |
Hi Steve,
I am afraid that you have had me rather confused... not sure
whether you are talking about text displayed in a TIB_Memo
or simply text displayed in grid cell (not currently in the
memo that had been used to edit it).
I will assume the later because I did notice some strange code
in the ib_grid.pas of the v4.9 series:
// Now draw the text
if gdtWordWrap in Opts then
DrawTextA( Canvas.Handle, PAnsiChar(CellDisplayText), -1, tmpRect, tmpFlags )
else
begin
tmpS := CellDisplayText;
replace_string( tmpS, #13, '#13' );
replace_string( tmpS, #10, '#10' );
replace_string( tmpS, #9, '#9' );
DrawTextA( Canvas.Handle, PAnsiChar(tmpS), -1, tmpRect, tmpFlags )
end;
I find this very odd and, to be honest, not really acceptable.
1. WordWrap has little to nothing to do about explicit CR/LF
2. If you want to turn such text into a single line then the
usual approach would be to replace the cr/lf with a single
space character
3. No idea why tab would be included in this processing
I keep wondering if this is left over from someone's debugging.
But... the few lines above show you how to avoid the problem
without altering the code - just turn on gdtWordWrap. Not
ideal (for own code I would just display the text as given,
or if limited to one line just the first line).
Steve also wrote:
I cant say I noticed code that would do this... but have not
gone looking.
--
Geoff Worboys
Telesis Computing
I am afraid that you have had me rather confused... not sure
whether you are talking about text displayed in a TIB_Memo
or simply text displayed in grid cell (not currently in the
memo that had been used to edit it).
I will assume the later because I did notice some strange code
in the ib_grid.pas of the v4.9 series:
// Now draw the text
if gdtWordWrap in Opts then
DrawTextA( Canvas.Handle, PAnsiChar(CellDisplayText), -1, tmpRect, tmpFlags )
else
begin
tmpS := CellDisplayText;
replace_string( tmpS, #13, '#13' );
replace_string( tmpS, #10, '#10' );
replace_string( tmpS, #9, '#9' );
DrawTextA( Canvas.Handle, PAnsiChar(tmpS), -1, tmpRect, tmpFlags )
end;
I find this very odd and, to be honest, not really acceptable.
1. WordWrap has little to nothing to do about explicit CR/LF
2. If you want to turn such text into a single line then the
usual approach would be to replace the cr/lf with a single
space character
3. No idea why tab would be included in this processing
I keep wondering if this is left over from someone's debugging.
But... the few lines above show you how to avoid the problem
without altering the code - just turn on gdtWordWrap. Not
ideal (for own code I would just display the text as given,
or if limited to one line just the first line).
Steve also wrote:
> Apparently it is also with TIB_edit showing textAre you saying that you also see '#13#10' inside TIB_Edit?
> created in TIB_Memo.
I cant say I noticed code that would do this... but have not
gone looking.
--
Geoff Worboys
Telesis Computing