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

Trap datasource scrolling in design time

edited January 2003 in Component Writing
Hi again,

I've created a component that is linked to a datapipeline. The component
draws lots of DB related fields. I can get the text value of the field
correctly when printing or previewing.

The problem I have is that when the datasource scrolls in the preview my
component doesn't repaint itself. I'v looked into ppPrnabl and ppCtrls to
see how a standard ppDBText does this but to no avail.

I've override the IsDataAware function and set the return value to True to
no success.

thanks

Daniel

Comments

  • edited January 2003
    See the TppDBText.GetTheText method. That is where the DBText gets the data
    from the pipe.

    What is your class descending from?

    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited January 2003
    The main component (a grid) descends from a TppCustomComponent. It creates some
    DrawCommands. It's these draw commands that needs to be repainted. Invalidate
    the "parent" (the grid) when the data scrolls.

    Like I've said, when printing it's ok but in preview the grid isn't invalidated.
    I have to resize it or make some modifications to make it repaint.

    Daniel
  • edited January 2003
    The datasource scrolls on a page and you want to redraw it, using the same
    draw command, or a new draw command? Does the draw command change the data
    that should print on the same page?

    If you have a page in the preview and you want to redraw it, then call:

    TppViewer(ppReport1.PreviewForm.Viewer).ScreenDevice.RenderPage;
    TppViewer(ppReport1.PreviewForm.Viewer).RefreshPage;

    Otherwise, you'll have to rerequest the page from the engine so that it
    recreates the darw commands and a new page object to be drawn onteh screen
    device. I posted this a few days ago in the other newsgroup:

    "You'll need to have the report engine drop that page from its cache, then
    tell the screen device to rerequest the page. The drill down subreport
    behavior does this. There is a method on the report to reset from a given
    page number. This clears all pages from that page forward and they are
    regenerated. You can ask the Viewer to go to a page. However,
    Viewer.GoToPage has a check to keep it from going to the same page, so that
    doesn't work. You have to make a page request on the screne device. Here is
    a simple example. Go to page two and click the blue label. Then check out
    the OnDrawCommandClick event handler for the label."

    http://www.digital-metaphors.com/tips/DrawCommandClickReRequestPage.zip




    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.