Search code examples
powerbuilderdatawindow

Power Builder - DataWindow paging


I'll just straight to the question, does DataWindow control has pagination? Or do we have to write our own pagination code? Can anyone give information about Data Window pagination.

I'm using PB ver 9.0. In what version pagination is available?

PS. I don't understand PB, but having a project in PB right now

Thank you


Solution

  • Datawindow has Pagination since PB possibly 1.0 as Terry said. I am seeing it since PB 2.0 and till 12.5 that is the present out there. However, if you are seeking how to provide the interface for First, Prev, next and Last then you need to place buttons on Window or on the DataWindow object and place some one liner codes as follows.

    In case of Window command buttons, you need to use the following code: First:

    dw_1.ScrollToRow(1)
    

    Prev:

    dw_1.ScrollPriorPage()
    

    Next:

    dw_1.scrollNextPage()
    

    Last:

    dw_1.ScrollToRow(dw_1.rowcount())
    

    If using datawindow object buttons, you may just select the appropriate action from the drop down options. All such actions are available as simple options.

    With this information, merge the info that Terry provided that of rendering a display. If you are displaying data on screen then the DataWindow control uses the datawindow control dimensions to render the pagination i.e. calculates the no of pages etc. If you write the following code it will render the page as per the page settings of the default printer or the printer set as the current printer.

    dw_1.Modify("datawindow.print.preview=yes")
    

    To set the currently select printer use the following code:

    PrintSetup()
    

    Cheers!