1. David Lopez Sanchez
  2. PowerBuilder
  3. Wednesday, 13 March 2024 12:33 PM UTC

Hi,

I have an incidence, I have a datawindow that in the resize event I modify the width of some rectangles to make them the size of the dw (I use them as header and I want them to be always seen the full size of the window), when the window is enlarged, the datawindow works correctly, but once the window starts to be reduced, the scrollbar of the datawindow appears although the internal size of the datawindow is smaller.

Attached is the example code in PB2022 R3, although it occurs in all versions.

 

This is the original size you see when you open the window, without the scroll bar.

 

I enlarge the size and it resizes correctly.

 

Once enlarged, if I reduce the width is when the bottom scrollbar starts to show.

 

If I move the bar, you can see that the rectangle is the correct size, but the interior of the dw has not been resized.

 

 

I've tried to repaint the datawindow with setredraw, groupcalc,... but it doesn't update the size.
I have also tried to modify the HorizontalScrollMaximum, but it doesn't work.
Any suggestions?

 

 

Attachments (2)
David Lopez Sanchez Accepted Answer Pending Moderation
  1. Monday, 18 March 2024 07:08 AM UTC
  2. PowerBuilder
  3. # 1

Hi

Thank you very much, in the end I'm going to work on hiding the scrollbar and hope it will work in the future.

Regards

 

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Saturday, 16 March 2024 04:31 AM UTC
  2. PowerBuilder
  3. # 2

*** Edited to include mention of HorizontalScrollPosition in the possible workaround. ***

David -

This behavior appears to be caused by the HorizontalScrollMaximum property of the DataWindow object. Specifically, the value of this property is always based on the largest (X-position + Width) value of all DWObjects that has ever occurred instead of the largest current (X-position + Width) value of all DWObjects. Unfortunately, as you have found out, this property is read-only and cannot be modified or reset.

I have reproduced your demo app and eliminated all unnecessary code and included the display of this property's value in a computed field, and attached this new demo app in a public bug/enhancement ticket, ID 11766.

One possible workaround came to mind while working on this, however:

Let's say you add a hidden vertical line in the DataWindow and place it just to the right of the rightmost DWObject. Do nothing if the HorizontalScrollPosition property's value is non-zero, as this means the user is currently scrolled to the right. If it is zero, continue. Call this hidden vertical line l_rightmostedge. In the resize event, as you resize the DW control, obtain the X1 value of line l_rightmostedge and check to determine if it has been "cropped" by the right edge of the DataWindow control (if it was visible, that is)... a fairly simple calculation. If so, show the DW control's horizontal scroll bar and if not, hide it.

Best regards, John

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 13 March 2024 17:30 PM UTC
  2. PowerBuilder
  3. # 3

Hi, David - 

Try subtracting 12 PBU's (three pixels) instead of 4 PBU's (one pixel). I had to do this in my "Grid Heading" app that is available in CodeXchange to get rid of the DW's horizontal scrollbar when dynamically "shrinking" the width of DWObjects. I have no idea why this worked in my case, but I stumbled upon it during development.

Best regards, John

Comment
  1. David Lopez Sanchez
  2. Thursday, 14 March 2024 07:14 AM UTC
thanks, but it didn't work.
  1. Helpful
There are no comments made yet.
David Lopez Sanchez Accepted Answer Pending Moderation
  1. Wednesday, 13 March 2024 16:53 PM UTC
  2. PowerBuilder
  3. # 4

Hi,

I am using rectangles as section separators in a single datawindow.

Due to the different screen sizes, we need to properly control the resizing so that it looks correct.

The only thing I have come up with is to hide the scrollbar when we have the actual size of the dw, but when it is smaller, the scrollbar looks incorrect.

Normally, we usually put separators outside of datawindows, and it is an object that is attached on top of the dw. However, in this case, since it is the same datawindow, I was trying to put it inside, since it only acts at the title and section separator level.

You can see in the example, the first bar with buttons does not belong to the datawindow, it is attached outside.

Regards

 

Comment
  1. Chris Pollach @Appeon
  2. Wednesday, 13 March 2024 17:03 PM UTC
Hi David;

I do this all the time in various DWO's but I never use rectangles!

Instead, I use the Group Header or Trailer Band with an assigned background colour to achieve the same look & feel as you desire.

That way, no weird resizing in the DWO is required at all. Food for thought. HTH

Regards .. Chris
  1. Helpful 1
  1. David Lopez Sanchez
  2. Thursday, 14 March 2024 07:20 AM UTC
thanks, but in the groups I cannot edit the fields, and it is not only 1 header, I should create several groups to simulate the different sections.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Thursday, 14 March 2024 23:28 PM UTC
Yes, that is what I would do. ;-)
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 13 March 2024 15:58 PM UTC
  2. PowerBuilder
  3. # 5

Hi David;

  I would like to start this response with the question ...

What are you trying to achieve GUI wise in the DWO?

Regards ... Chris

Comment
There are no comments made yet.
David Lopez Sanchez Accepted Answer Pending Moderation
  1. Wednesday, 13 March 2024 12:36 PM UTC
  2. PowerBuilder
  3. # 6

Attached is the resize code:

 

dw_1.Width = newwidth
dw_1.Height = newheight

dw_1.Object.r_1.Width = newwidth - 4

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.