1. Daniel Vivier
  2. PowerBuilder
  3. Saturday, 31 August 2019 12:29 PM UTC

I have a very wide DW, where I want the user to be able to continually see the first two columns, while scrolling horizontally to see the rest of the columns. That is exactly what Excel's Freeze Panes feature allows.

What I have come up with so far is:

dw1.HSplitScroll = TRUE
dw1.Object.DataWindow.HorizontalScrollSplit = 1897 // width of first 2 columns

That puts in the splitter bar where I want it. But both the left and right sides can be scrolled to see all of the columns, which could be confusing to the users! I want the left side to be frozen (not scrollable) and the right size to not be able to be scrolled left back into the first two columns.

I have read the descriptions of the HorizontalScrollPosition, HorizontalScrollPosition2, HorizontalScrollMaximum and HorizontalScrollMaximum2 properties, and it does not appear that they will help in any way, to the best of my understanding of their descriptions. (I don't find those descriptions very clear at all, mind you.) I also looked at the ScrollHorizontal event.

Am I missing something? Is there some magic combination of the event and the properties that will allow me to prevent the scrolling in the left pane, and limit the scrolling in the right one?

Thanks.

Accepted Answer
Daniel Vivier Accepted Answer Pending Moderation
  1. Saturday, 31 August 2019 12:51 PM UTC
  2. PowerBuilder
  3. # Permalink

OK, I have found a more or less solution. In the ScrollHorizontal event of the DW, I added:

CHOOSE CASE pane
   CASE 1
      if scrollpos > 0 then
         Object.DataWindow.HorizontalScrollPosition = 0
      end if
   CASE 2
      if scrollpos < 1897 then
         Object.DataWindow.HorizontalScrollPosition2 = 1897
      end if
END CHOOSE

The number in the CASE 2 (for the 2nd pane) is the same value as where I put the split.

However I have noticed one weirdness from adding the splitter (whether or not that code above is included): the DW no longer displays the far right edge of the last column. Is that a known problem? Any work-around?

Thanks.

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Monday, 2 September 2019 23:13 PM UTC
  2. PowerBuilder
  3. # 1

Hi, Dan -

If it was me, I would experiment with using two DataWindow objects having the same SQL Select. In DWO1, display only the first two columns. In DWO2, all remaining columns. Use two DataWindow Controls and ShareData to share the buffers. In DWC1, display DWO1, but turn off display of vertical and horz. scroll bars. Turn them both on in DWC2. Sync vertical scrolling between the two DWC's (example's are easy to find). Any horizontantal scrolling of columns will be limited to the second DWC.

You'd probably have to use a footer in DWO1 that is higher than in DWO2 due to not having a horz. scrollbar.

Comment
  1. Daniel Vivier
  2. Monday, 2 September 2019 23:23 PM UTC
Thanks, John, I actually spent several hours trying that approach (most of it fighting to make our resizing code work properly as I sized the window horizontally). However, the apparently simple code to synchronize the vertical scrolling didn't work right - perhaps because I wasn't aware of the trick you suggested about the footer - so I gave up on it.

Having said that, the solution I finally came up with and posted here, using one DW, works basically perfectly, and was much easier to implement.
  1. Helpful
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Saturday, 31 August 2019 19:02 PM UTC
  2. PowerBuilder
  3. # 2

Dan -
   I vaguely remember that occurring back in the day, and my work-around was to add a computed COLUMN named FILLER and add it to the end ot the row. Size it to get what you need to be visible.

   At the end of the SQL, just add:
        ' '  filler

Later -
Olan

Comment
  1. Daniel Vivier
  2. Saturday, 31 August 2019 21:12 PM UTC
Works perfectly Olan. Thanks so much. Bit obvious now that I think of it! Since it's a computed field, it doesn't actually need SQL.
  1. Helpful
  1. Olan Knight
  2. Sunday, 1 September 2019 02:06 AM UTC
Wonderful, I'm glad that worked for you!



Later -

Olan
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Saturday, 31 August 2019 12:52 PM UTC
  2. PowerBuilder
  3. # 3

Try turning off horizontal scrolling in the DataWindow control and adding a separate horizontal scrollbar control.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.