PowerBuilder Synchronized DataWindow Scrolling Not Working Properly

Posted on 2010-09-23
Last Modified: 2013-12-26
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.

Question by:DennisStackley
  • 3
  • 2
LVL 14

Expert Comment

ID: 33825031
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.


Author Comment

ID: 33845628

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?

LVL 14

Accepted Solution

sandeep_patel earned 500 total points
ID: 33851383
You no need to set visible property for objects were in detail band. Those should be displayed always. Just change visible property of objects you moved from summary to detail.

Please refer to attached sample datawindow. It has control t_2 hidden in detail band and has visible property set as above and also detail datawindow has AutoHeight property true.

Rename file to .srd to import.

Author Comment

ID: 33900053

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!


Author Comment

ID: 33900083

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!


Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
matchUp  challenge 9 123
mapShare challenge 13 145
word0 challenge 3 110
Bartender label printing - switch on and off graphics 3 71
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question