Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Changing TppLabel color during runtime

edited August 2008 in General
Hello,

I'm using D2008 with RB10.9. I have a TppLabel within a group header that
contains a message or a Timestamp. In the OnGetText event I determine the
message to display and also what color to make the text. It seems that the
color does not always get set properly. Stepping through my code it appears
that I'm setting the MyLabel.Font.Color to the correct color but its
displaying the wrong color. Is there a trick to getting the correct color
all the time? Sometimes it is correct. I tried setting the .Tag property
to what I wanted and then in the OnPrint event setting the color but that
doesn't work.

Thanks in advance,
Rodger

Comments

  • edited August 2008
    Hi Rodger,

    Perhaps the OnGetText event fires too late to change the color property, try
    using the Band.BeforePrint event instead. When you say that the color is
    incorrect do you mean that you are seeing no change in color from the
    original or it is changing, but to the wrong color?

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2008
    It is changing to the wrong color. The odd thing is I can go through the
    pages and then go backwards through the pages and they will change colors.
    So they could have been the correct color the first time then when I cycle
    back through them the colors are wrong. Also some of them are just plain
    wrong even the first time through the pages.

    Should I move all the OnGetText code to the Band.BeforePrint? I don't
    really know what color to make the text until I know what the text is.

    Thanks,
    Rodger Van Kirk




  • edited August 2008
    Hi Rodger,

    If the text is inside a data field, you can access it from the BeforePrint
    event using the Report.Datapipeline[], however I do not believe
    this is the issue. Try tracing into your event code and see why the color
    is incorrect. Perhaps the conditional logic is not correct. If you would
    like, you can copy the event code here and I can try in on my machine for
    you.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2008
    Just moving the code to the Band.BeforePrint fixed the issue. I think the
    problem happened depending on if the group header fell at the bottom of the
    page with no details below it. from that point on the colors were off and
    if I went back a page after viewing that page the first item on the previous
    page's color would be off.

    On a side note. How do I make it so that when a group header prints it
    needs at least 1 detail band to be shown on that page otherwise it will wait
    and print the header on the next page? Seems like I did this once before
    long time ago but I can't remember what I set or did. I know its no the
    keep together setting.

    Thanks in advance,
    Rodger Van Kirk

  • edited August 2008
    Hi Rodger,

    Try adjusting the Group.NewPageThreshold property to keep the group headers
    from printing near the bottom without details below it.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.