 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Christian Klopfer Guest
|
Posted: Fri Oct 17, 2003 8:26 am Post subject: Disable Autowrap in QR |
|
|
Hi all,
I'v a problem with the TQRLabel-component of QuickReport (Delivered with
Delphi 5.0 as version 3.0)
I create a grid on runtime. for each cell I use a TQRLabel and set all
frames to true to imitate a TStringGrid. All QRLabels are set with following
properties:
Autosize = False
Frame.DrawBottom = true
Frame.DrawLeft = true
Frame.DrawRight = true
Frame.DrawTop = true
Height = 15
Width = 75
WordWrap = True
So far everything works fine. But if I have a text that is longer than the
width of 75, the TQRLabel insert at the beginning a LineFeed and all the
text is below the height of the component. I think the WordWrap should
ignore that as it is set to false. The main problem is that the program uses
several languages and if the first word is longer than 75 The "cell" seems
to be blank, as the text is wrapped to the next hidden line below the "cell"
Here a small chart about the problem:
1) Text is smaller than width of TQRLabel
| Quote: | ______________
[Text fit ]
-------------------
|
2) A wrap after "until"
| Quote: | ______________
[ This text fit until ] <CR
-------------------
the the width is reached and it makes a wrap
|
3) A wrap before the first word and the cells seems to be blank
| Quote: | _______
[ ]
---------
CR>Unfortunately here a wrap before first word
|
<CR> = The position where the unexpected wrap appears
Can anyone give me a hint if it is my fault or is it a bug. Can someone say
how to fix it? I do not own the source...
greetings and thanks for help
Chris
|
|
| Back to top |
|
 |
Christian Klopfer Guest
|
Posted: Fri Oct 17, 2003 9:04 am Post subject: Re: Disable Autowrap in QR |
|
|
Sorry, I made a mistake in the data.
I wrote that WordWrap is set to true. It is set to false in the source code
of course ;-)
The problem still exists
greetings
Chris
|
|
| Back to top |
|
 |
Dan Comeau Guest
|
Posted: Tue Oct 21, 2003 2:43 am Post subject: Re: Disable Autowrap in QR |
|
|
Christian,
Here's my work-around. It may not be neat or super fast but it works
for me. Since the regular (non-QR) TMemo handles the wordwrap
correctly, I wrote this function to use a TMemo (this is the lazy way
to do it) to embed linefeeds in a string and then use that in the
QRLabel. You can chose to output just one line in your QRLabel, for
your grid -- change this function accordingly, or maybe QRLable works
as it is.
function TPrintDlg.EmbedWordWraps(AQRCustomLabel: TQRCustomLabel;
AText: String): String;
var
Line: integer;
begin
// memWordWrap is a disabled component on the PrintDialog form
// Its sole purpose is to be used here. QR Report forms don't like
TMemo's.
// Dynamically creating a TMemo here had several problems with
Windows handles.
// You get the same problem if Visible := False.
memWordWrap.Lines.BeginUpdate;
memWordWrap.Lines.Clear;
memWordWrap.Font := AQRCustomLabel.Font;
memWordWrap.Width := AQRCustomLabel.Width;
memWordWrap.Lines.Add(AText);
memWordWrap.Lines.EndUpdate;
Result := '';
for Line := 0 to memWordWrap.Lines.Count-2 {don't do last line yet}
do
begin
Result := Result + memWordWrap.Lines[Line] + kLF;
end;
if memWordWrap.Lines.Count > 0 then
begin
Result := Result + memWordWrap.Lines[memWordWrap.Lines.Count-1];
end;
end; // EmbedWordWraps
On Fri, 17 Oct 2003 11:04:39 +0200, "Christian Klopfer"
<Christian-Klopfer (AT) Sauter-GmbH (DOT) de> wrote:
| Quote: | Sorry, I made a mistake in the data.
I wrote that WordWrap is set to true. It is set to false in the source code
of course ;-)
The problem still exists
greetings
Chris
|
|
|
| Back to top |
|
 |
Christian Klopfer Guest
|
Posted: Tue Oct 21, 2003 8:10 am Post subject: Re: Disable Autowrap in QR |
|
|
Hi Dan,
Thanks for your code. I hope that will work. Unusual solution - but why not
*g* Speed doesn't matter as long it works ;-)
cheers
Chris
"Dan Comeau" <myfirstandlastname (AT) rogers (DOT) com> schrieb im Newsbeitrag
news:bv69pvghlmvhqmrbb4eu1oh83ugno56uqi (AT) 4ax (DOT) com...
| Quote: | Christian,
Here's my work-around. It may not be neat or super fast but it works
for me. Since the regular (non-QR) TMemo handles the wordwrap
correctly, I wrote this function to use a TMemo (this is the lazy way
to do it) to embed linefeeds in a string and then use that in the
QRLabel. You can chose to output just one line in your QRLabel, for
your grid -- change this function accordingly, or maybe QRLable works
as it is.
function TPrintDlg.EmbedWordWraps(AQRCustomLabel: TQRCustomLabel;
AText: String): String;
var
Line: integer;
begin
// memWordWrap is a disabled component on the PrintDialog form
// Its sole purpose is to be used here. QR Report forms don't like
TMemo's.
// Dynamically creating a TMemo here had several problems with
Windows handles.
// You get the same problem if Visible := False.
memWordWrap.Lines.BeginUpdate;
memWordWrap.Lines.Clear;
memWordWrap.Font := AQRCustomLabel.Font;
memWordWrap.Width := AQRCustomLabel.Width;
memWordWrap.Lines.Add(AText);
memWordWrap.Lines.EndUpdate;
Result := '';
for Line := 0 to memWordWrap.Lines.Count-2 {don't do last line yet}
do
begin
Result := Result + memWordWrap.Lines[Line] + kLF;
end;
if memWordWrap.Lines.Count > 0 then
begin
Result := Result + memWordWrap.Lines[memWordWrap.Lines.Count-1];
end;
end; // EmbedWordWraps
On Fri, 17 Oct 2003 11:04:39 +0200, "Christian Klopfer"
[email]Christian-Klopfer (AT) Sauter-GmbH (DOT) de[/email]> wrote:
Sorry, I made a mistake in the data.
I wrote that WordWrap is set to true. It is set to false in the source
code
of course ;-)
The problem still exists
greetings
Chris
|
|
|
| Back to top |
|
 |
Dan Comeau Guest
|
Posted: Tue Oct 21, 2003 8:54 pm Post subject: Re: Disable Autowrap in QR |
|
|
Christian,
I noticed today that this code wordwraps incorrectly -- as if the
field is much shorter than it really is. I'm investigating it right
now. I have a string that is usually a date but can be a date with
extra text also, so that it needs to wordwrap. The field is wide
enough to not wrap something like 17 Jun 1986 but this function embeds
a linefeed before the year. Weird.
Dan
|
|
| Back to top |
|
 |
Dan Comeau Guest
|
Posted: Tue Oct 21, 2003 10:29 pm Post subject: Re: Disable Autowrap in QR |
|
|
Christian,
It seems that TMemo has a left margin that TQRLabel doesn't. It could
also be that their right margins are different too. Here's an
alternate version of my function to account for this.
const
kMemoWrapMarginAdjustment = 8;
....
function TPrintDlg.EmbedWordWraps(AQRCustomLabel: TQRCustomLabel;
AText: String): String;
var
Line: integer;
begin
// memWordWrap is a disabled component on the PrintDialog form
// Its sole purpose is to be used here. QR Report forms don't like
TMemo's.
// Dynamically creating a TMemo here had several problems with
Windows handles.
// You get the same problem if Visible := False.
memWordWrap.Lines.BeginUpdate;
memWordWrap.Lines.Clear;
memWordWrap.Font := AQRCustomLabel.Font;
memWordWrap.Width := AQRCustomLabel.Width +
kMemoWrapMarginAdjustment;
memWordWrap.Lines.Add(AText);
memWordWrap.Lines.EndUpdate;
Result := '';
for Line := 0 to memWordWrap.Lines.Count-2 {don't do last line yet}
do
begin
Result := Result + memWordWrap.Lines[Line] + kLF;
end;
if memWordWrap.Lines.Count > 0 then
begin
Result := Result + memWordWrap.Lines[memWordWrap.Lines.Count-1];
end;
end; // EmbedWordWraps
|
|
| Back to top |
|
 |
|
|
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
|
|