Moving Labels
RB v 6.03
I change the text value of a TppLabel in the OnGetText event in the object
inspector. I have another label component right next to the label I have
changed and I want to shift its left position relative to the size of the
changed label. i.e.
MovingLabel.Left := ChangedLabel.Left + ChangedLabel.Width + .125;
However when I do this the label I am moving does not move.
I have tried this in the same event procedure right after I have changed the
Text of the Changed Label.
And I have also tried to do it in the OnPrint event with no success.
Is this possible to do? If so what am I missing?
Bill
I change the text value of a TppLabel in the OnGetText event in the object
inspector. I have another label component right next to the label I have
changed and I want to shift its left position relative to the size of the
changed label. i.e.
MovingLabel.Left := ChangedLabel.Left + ChangedLabel.Width + .125;
However when I do this the label I am moving does not move.
I have tried this in the same event procedure right after I have changed the
Text of the Changed Label.
And I have also tried to do it in the OnPrint event with no success.
Is this possible to do? If so what am I missing?
Bill
This discussion has been closed.
Comments
Delete it from the newsgroup if you like.
Bill
difference. Just lucky placement when I designed the report. When the
changing label was longer or shorter it didn't move.
So please consider the original post as a valid question.
Bill
You need to use the Band.OnBeforePrint event to move labels around rather
than the Label.OnPrint. This should change the results you are getting.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I also assigned the caption in the OnBeforePrint event of the band before
moving my labels to see if that would work and they still didn't move.
Bill
Please send an example with the code you use to try to move the label in
.zip format to support@digital-metaphors.com and I'll take a look at it for
you.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
post. Just with my names for the components.
This is the name of the procedure that the IDE generated for the
OnBeforePrint event
other than that the code in my earlier post is exactly what I put in there.
procedure TfmMyForm.ppTitleBand1BeforePrint(Sender: TObject);
Bill
I created a small app to test this and it seemed to work correctly. Below
is a link to the test application I created to test with. Let me know if
you get different results than I do.
http://www.digital-metaphors.com/tips/MoveLabel.zip
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
autosizing itself.
I have attached an example of what it is doing.
Complile the example and then type in a long string of text in the edit box.
Then type in a short 4 letter string.
You will see that the moving label will only move to the position to the
right of the original width of the label.
So my actual question is this. Is it possible after setting the text value
of a label to get the width property updated so that the true with of the
control is reflected?
Bill
Try downloading the example again. I changed it to move the label based on
the text width, not the control box. This seems to work around the autosize
issue.
http://www.digital-metaphors.com/tips/MoveLabel.zip
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com