Solved

PowerBuilder Synchronized DataWindow Scrolling Not Working Properly

Posted on 2010-09-23
5
2,406 Views
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.

Thanks,
ds
0
Comment
Question by:DennisStackley
  • 3
  • 2
5 Comments
 
LVL 14

Expert Comment

by:sandeep_patel
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.

Thanks,
Sandeep
0
 

Author Comment

by:DennisStackley
ID: 33845628
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
0
 
LVL 14

Accepted Solution

by:
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.
d-test.txt
0
 

Author Comment

by:DennisStackley
ID: 33900053
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
0
 

Author Comment

by:DennisStackley
ID: 33900083
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
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now