1. Subbiya Vasumoorthy
  2. PowerBuilder
  3. Tuesday, 30 April 2024 13:57 PM UTC

Hi Team,

Need help on scrolling user object based on row selection.

In a window, I have a datawindow on the left side. On the right side, I have a user object(container for user object) inherited from u_base. I have opened several user objects one by one(using x, y position) on inside the user object which is placed on the right side. The no. of user objects opened on the right side is based on the row clicked on the left side dw. 

Opening the user object and scrolling through scroll bar on the right side was good. The only issue is, I am not able to scroll to a specific position inside the user object. I have the Y position and height of each user object opened inside the container.

I tried the following steps to manually scroll the user object.

  • I created an event in the user object container with event id pbm_vscroll, and executed it using scrollcode(2 or 3)  and with scrollpos
  • Created an local external function for SetScrollPos from USER32.DLL
    • SetScrollPos(Handle(uo_container_emr_scroll), -2, ll_temp_scroll_pos, true
  • Tried scrolling using send function
    • Send(Handle(this), 277, 1, 0) - using this I was able to scroll SB_LINEDOWN, SB_LINEUP, SB_TOP, SB_BOTTOM,... but not to the exact position where I was scroll. 

My questions are,

  1. How can i get the exact scroll position of the start of the user object opened inside a container, can i refer the Y position or Y + height of previous opened user obejct ?
  2. Even If i got the exact scroll position, how should I have to use it.? using send or any windows API. ?

Thanks,

Subbiya

 

Accepted Answer
John Fauss Accepted Answer Pending Moderation
  1. Friday, 17 May 2024 02:46 AM UTC
  2. PowerBuilder
  3. # Permalink

Attached to this post is a revised/enhanced version of the example application posted earlier. There are several changes:

  • A highly-visible (red background) static text control has been placed at the bottom of the user object. This allows you to verify that you can see the bottom of the user object when the app is running and you've scrolled all of the way to the bottom.
  • The vertical scrollbar now responds to Up/Down arrow keys and Page Up/Page Down keys. Arrow keys behave the same as clicking on either scrollbar arrow, and Page keys behave the same as clicking in the scroll bar above or below the scroll thumb. Several scrollbar mapped user events were utilized for this functionality.
  • The amount of positional adjustment made by arrow/page keys or clicks can be changed via user input values. There is little validation of the user input value, as this app is purely for illustrative purposes.
  • The scrollbar responds to rotation of the mouse wheel by recognizing the WM_MOUSEWHEEL Windows message via the PB "Other" event, but only when the cursor is over the scrollbar control. A static text control in the window displays the value sent by Windows when the mouse wheel is rotated. Each "click" of the mouse wheel is equivalent to pressing the Up/Down arrow keys. It should be easy to implement the same mouse wheel functionality when the cursor is also over the user object, if desired.

Best regards, John

Attachments (1)
Comment
  1. Subbiya Vasumoorthy
  2. Friday, 17 May 2024 09:45 AM UTC
Hi John,

Thankyou for your response and spending time on this query. Worked like a charm.
  1. Helpful
  1. John Fauss
  2. Friday, 17 May 2024 13:11 PM UTC
You're welcome, Subbiya! I'm glad to learn it helped you. Good luck on your project!
  1. Helpful
There are no comments made yet.
Subbiya Vasumoorthy Accepted Answer Pending Moderation
  1. Tuesday, 7 May 2024 19:28 PM UTC
  2. PowerBuilder
  3. # 1

Hi John,
Thankyou for the attachment, I tried with that solution, everything works fine except an blank page at the end of the user object.  As per PowerBuilder Help Document, I set the UnitsPerLine but still I see the blank page displays at the end the user object.

The total height of the user object after opening all controls inside it was 48336 (25 user objects opened inside), so I calculate the Units per line as below

ll_maxpos  = 48336

ll_upl = round(((ll_maxpos * 0.75) / 100), 0)

uo_container.unitsperline = ll_upl

 

But when I click the scroll bar down arrow to the end, there are some blank spaces appears, because of this, I'm not able to relate the user object Y position with scrollbar position, how can i scroll to last position in the scroll bar with blank page. Please see the attachment.

Note: for scrollbar, I used VSB control as mentioned in your previous attachment.

Thankyou,

Subbiya

Attachments (2)
Comment
  1. John Fauss
  2. Thursday, 9 May 2024 01:16 AM UTC
25 user objects! Goodness gracious, that's a lot!

First, I don't know if you are using the vertical scroll bar (vsb) that is available in a user object. If you are, my advice to you is to NOT use it and instead use a vsb control that is sized and placed adjacent to the user object, as I showed in the little example app I posted earlier. The vsb that is internal to the user object cannot be manipulated or interrogated. It can be used when all you wish to do is provide basic scrolling functionality, but from what I see your needs are above and beyond that.

Second, I suggest you not use the UnitsPerLine and related properties. It's not difficult to manage everything yourself and then you have complete control of the behavior. I'm working on revising/enhancing the example app and will post it in a new response as soon as I can.

Third, the behavior that you're experiencing of scrolling down to where everything is empty/blank, is because you've scrolled so far that the bottom edge of the user object is at the very top of the displayed control. To remedy, set the MaxPosition property to the design height of your user object (48336 PBU's) minus the height of the user object control in the window. For example, if the design height is 2500 PBU's and the height of the user object control in the window is 500 PBU's, then set the MaxPosition of the vsb to 2500 - 500 = 2000 pbu's.
  1. Helpful
  1. Subbiya Vasumoorthy
  2. Thursday, 9 May 2024 18:42 PM UTC
Thankyou for your response. I'm using VSB control only not the scroll bar on the user object. Today we had a demo with our client, they are not worried about the extra blank page at the bottom of the user object. But I tried with your solution mentioned above, I just set maxposition = design_height - uo height but the scroll bar stops before it reaches the end content. we can skip this. But, can you please suggest me a way to implement mouse wheel scroll on the user object, currently only VSB control up/down arrow works. FYI., All the user objects are opened inside a user object which is inherited from u_base



I tried the below code on user object other event, but it doesn't works, while scrolling the mouse wheel, I get 296 as the message.number



IF message.number= 296 THEN

message.processed = true



if wparam < 0 then // down wheel

send(handle(this), 277, 1, 0)

else

send(handle(this), 277, 0, 0)

end if

END IF
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 30 April 2024 22:57 PM UTC
  2. PowerBuilder
  3. # 2

Attached is a simple, single-window example application that shows one way to vertically scroll the contents of a user object and optionally position the scrolling to defined spots. I hope this gives you some ideas that will help you create a solution for your issue.

Attachments (1)
Comment
  1. Armeen Mazda @Appeon
  2. Wednesday, 1 May 2024 13:26 PM UTC
Thanks John!
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 30 April 2024 18:35 PM UTC
  2. PowerBuilder
  3. # 3

Hi, Subbiya -

What version, release, build of PB are you using? (It's always a good idea to include this info in a question, by the way...)

In order to gain a better understanding of what you are asking about, would it be possible for you to include a modest-sized screen snapshot or two in a new reply in this thread? Not the full monitor, please, as the granularity (and the usefulness) gets smaller as the size of the screenshot gets larger.

Best regards, John 

Comment
  1. Subbiya Vasumoorthy
  2. Tuesday, 30 April 2024 19:01 PM UTC
We are on Version 2022 R3 Build 3305, Unfortunately, I cannot take the screen-print, it is disabled here. But I can explain in detail again.



Here is my scenario

In a window, on the left side, I have a dw (let's assume dw_1), on the right side, I have a user object(let's assume uo_1). On clicking the row or during the rowfocuschanged event of dw_1, I need to open a user object inside the user object uo_1. So, if there are 10 rows on the dw_1 then 10 userobject has to be opened. I was able to do this, so I have opened 10 user objects vertically inside uo_1 using x and y parameters in openuserobject function. Now, When I click the row on dw_1, I need to to scroll to the appropriate user object inside the uo_1. I have stored the X and Y position of each user object that has been opened inside the uo_1
  1. Helpful
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.