Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

PowerBuilder Synchronized DataWindow Scrolling Not Working Properly

Posted on 2010-09-23
5
Medium Priority
?
2,640 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
[X]
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
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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
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…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

664 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