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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

623 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