Link to home
Start Free TrialLog in
Avatar of DennisStackley
DennisStackley

asked on

PowerBuilder Synchronized DataWindow Scrolling Not Working Properly

I am working on a pair of datawindows that are visible on a window. The upper datawindow has a scroll bar, while the bottom datawindow does not. Both datawindows are using the same datawindow dataobject. The datawindow being used has a header band, detail band, and summary band. NOTE: The upper and lower datawindows are sized just large enough on the window for only one row to be displayed for each click on the scroll bar.

When retrieve occurs, both datawindows are populated. If you click on the scroll bar of the upper datawindow to scroll down, the bottom datawindow scrolls in synchronization with the upper datawindow until you reach the bottom of the upper datawindow. At this point, the upper datawindow is displaying the summary band yet the bottom datawindow is displaying the last row in the detail band.

Here is the code in the ScrollVertical Event of the upper datawindow:
dw_lower.Object.datawindow.verticalscrollposition = scrollpos

The code above actually replaces code that was in place when the application was developed using PB version 5. The scrolling worked fine when it was version 5. When the application was migrated to PB 12, I replaced the script with the code above thinking it would resolve the problem. The problem still exists.

According to PB documentation, a ScrollToRow(lastrow) where lastrow is the number of detail rows + 1 should cause the summary band to be displayed but it doesn't. Just the last row in the detail band is displayed.

Any assistance would be greatly appreciated.

Thanks,
ds
Avatar of sandeep_patel
sandeep_patel
Flag of United States of America image

summary band height in not included in scrollposition calculation. You have two options.

1. Move summary detail to foot band
2. Move summary detail to detail band and keep it visible only if it is last row (i.e. if (getrow() = rowcount() , 1 , 0 )) and set autoheight property to true for detail band.

Thanks,
Sandeep
Avatar of DennisStackley
DennisStackley

ASKER

Sandeep,

Thank you for your suggestions. I tried your first suggestion (1.) but it didn't work. The second suggestion (2.) has potential after some tweaking. I ended up setting the visible attribute for all objects in the detail band with "if( getrow() = rowcount(), 0, 1 )" and for all objects in the summary band with "if( getrow() = rowcount(), 1, 0 )".  I then moved all objects in the summary band to the detail band. So now both sets of objects are in the detail band. Nothing is left in the summary band, so it has been collapsed.

The only problem now remaining is that the last row of detail does not appear in either datawindow. The totals row appear in both datawindows as it should. With the data I am currently working with, this isn't a problem because the last detail row is empty or all zeros.

Any further suggestions?

Thanks,
ds
ASKER CERTIFIED SOLUTION
Avatar of sandeep_patel
sandeep_patel
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sandeep,

Thanks for the example provided via the text file. It was a great help. Your solution appears to work except for one little problem. When scrolling the upper datawindow downward, the two datawindows are in sync until you click one too many times after reaching the last row. The first click after reaching the last row (and subsequent clicks thereafter) causes the bottom datawindow to display the last row of detail instead of the last row that had been in the summary. So they are out of sync at that point.

Any additional ideas? This is much closer than before. I do appreciate your help!

Thanks,
ds
Sandeep,

Please disregard my last post. After playing around with the items within the datawindow, I was able to get it to work without going out of sync. Kudos to you!

Thanks,
ds