Changing a Memo at Run-Time
Hi all,
RB 7.02 running on a Delphi 5.01 project ...
I am trying to devise some Zebra-printer labels. Most things are
functioning, EXCEPT I have a memo in an area called Description. I
need that area filled by the contents of either of two fields. One is
called Description, the other Extended Description. If there is
anything in ExtDesc, I want it to show, otherwise just print
Description. Sounded simple when I started.
I put both fields on the form and then tested for ExtendedDesc = ''
and then turned one or the other invisible. Nothing I could do would
leave the Extended Desc visible. I needed it to be word-wrapped and
turning on that feature in a ppDBText just made the thing disappear.
So, I switched to a ppMemo and tried to load it at run-time. The
result on first button push is empty, the second, the first 19
characters of the extended desc. That remains the case each subsequent
push. I've verified that the memo HOLDS the full text, I just don't
see it.
procedure TFrmViewZ.Button1Click(Sender: TObject);
var
PartNum : string;
ExtDescText : string;
DescText : string;
begin
DescText.lines.Clear;
PartNum := getS(TblZebraLocal,'PartNo');
DescText := getS(TblZebraLocal,'Desc');
ExtDescText := getS(dLU.mTblCatalog,'ExtendedDesc');
// test whether an extended description exists
if dLU.mTblCatalog.findkey([PartNum])
then DescText.lines.add(ExtDescText)
else DescText.lines.add(DescText);
// It's not showing, so better to save memo contents
descText.lines.SaveToFile('C:\temp\Desctext.txt');
Application.ProcessMessages;
pipZebraLocalBox.print;
end;
As you can see, I started saving the contents of the memo to
check for bizarre data. It shows: (no carriage returns in the actual
text):
This really is a long description of an assembly's main frame that
needs to be shipped.
But the best I could get is: This is really a lo
And that on the second button push.
Okay, what am I doing wrong. GM
==========================================
When replying via email please move all
numbers from right of at symbol to left of
at symbol to get email address.
RB 7.02 running on a Delphi 5.01 project ...
I am trying to devise some Zebra-printer labels. Most things are
functioning, EXCEPT I have a memo in an area called Description. I
need that area filled by the contents of either of two fields. One is
called Description, the other Extended Description. If there is
anything in ExtDesc, I want it to show, otherwise just print
Description. Sounded simple when I started.
I put both fields on the form and then tested for ExtendedDesc = ''
and then turned one or the other invisible. Nothing I could do would
leave the Extended Desc visible. I needed it to be word-wrapped and
turning on that feature in a ppDBText just made the thing disappear.
So, I switched to a ppMemo and tried to load it at run-time. The
result on first button push is empty, the second, the first 19
characters of the extended desc. That remains the case each subsequent
push. I've verified that the memo HOLDS the full text, I just don't
see it.
procedure TFrmViewZ.Button1Click(Sender: TObject);
var
PartNum : string;
ExtDescText : string;
DescText : string;
begin
DescText.lines.Clear;
PartNum := getS(TblZebraLocal,'PartNo');
DescText := getS(TblZebraLocal,'Desc');
ExtDescText := getS(dLU.mTblCatalog,'ExtendedDesc');
// test whether an extended description exists
if dLU.mTblCatalog.findkey([PartNum])
then DescText.lines.add(ExtDescText)
else DescText.lines.add(DescText);
// It's not showing, so better to save memo contents
descText.lines.SaveToFile('C:\temp\Desctext.txt');
Application.ProcessMessages;
pipZebraLocalBox.print;
end;
As you can see, I started saving the contents of the memo to
check for bizarre data. It shows: (no carriage returns in the actual
text):
This really is a long description of an assembly's main frame that
needs to be shipped.
But the best I could get is: This is really a lo
And that on the second button push.
Okay, what am I doing wrong. GM
==========================================
When replying via email please move all
numbers from right of at symbol to left of
at symbol to get email address.
This discussion has been closed.
Comments
I have not seen this behavior before. Do you have your memo set to Stretch?
If you start from scratch and place a TppMemo object on an empty report and
try to load the text manually, are you still getting the same behavior?
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
The problem of the missing data on the first run was a dumb
programming error on my part. Shouldn't have assigned the ExtendedDesc
until AFTER I'd done the findkey. Dunh!
Okay, so I put a separate report on the form, called it Z and put a
ppMemo on it. Then I assigned the text parallel with the problem
report's ppMemo. The text printed correctly on Z and still just a few
words on the problem report.
Sooo, I deleted the problem report's memo, replaced it with an
unedited ppMemo (default name: ppMemo2) and tried to print. This time
I got only a single word, not 17 character's worth. I then took a shot
at turning the stretch behaviour on. All text appeared ... in a column
that was approximately 17 characters wide and stretched into the area
below it that was filled with lines, boxes and other text. The width
was approximately half of the default 2 inch width assigned to it.
Hmmmm.
The font was changed to Times New Roman 14 from Arial 12 pt. Bit less
text showed in all, but it was in TNR14, for whatever that's worth.
So, it isn't a corrupted font.
Well, I tried hard-coding it into the ppMemo and commenting out the
reassignation code. I got most of the text in a column about 1.5
inches wide rather than the three inches I had made it. By the way,
the print preview in the designer ALWAYS shows it's okay. It's only
the print time preview shows it screwing up.
I tried printing the label to a PDF file and it prints the proper
version. I don't have the Zebra 105SL here, so I don't know if I will
be printing crap or what is desired.
If you want, I could send you screen snaps to show you the problem in
action. I am available at email I registered with, or I could send it
to the email listed at DM below.
Your guidance is appreciated.
GM
On Fri, 17 Feb 2006 08:21:55 -0700, "Nico Cizik \(Digital Metaphors\)"
will post the final resolution when it presents itself.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com