Hi Pawel;
This has nothing to do with the Vertical Scroll bar (although, that would be the "long" way around to solve this challenge). Instead, you need to have a look at the DW Object's VerticalScrollPosition property instead to make this behaviour super easy to implement. The same goes for the HorizontalScrollPosition property as well if you also need to scroll the DWO horizontally automatically as well.
This code has been in my STD Framework for quite some time. You can see it in action in the OrderEntry Demo App built from the framework when interacting with the Employee (Master / Detail) dialogue. In the lower DW Control, the DWO is scrolled vertically and horizontally to keep the App user focused on the long set of detail DWO's columns as the various column focus changes.
If you look into the frameworks ancestors for the base level DC ancestor, you will notice that it extends all DC's automatic VScroll / HScroll behaviours by the App developer setting either the ib_auto_vscroll and/or ib_auto_hscroll boolean property ON in the working (concrete) descendant DC. The code is actually implemented in the base ancestor DC named "vs_dc_detail_master" respectively. The use of these two variables is implemented in the "ItemFocusChanged" event so that any keyboard, mouse or SetColumn() command will fire this DC event. Then the ancestor code checks these two VScroll / HScroll boolean variables and if ON, implements the "DataWindow.VerticalScrollPosition = " and / or "DataWindow.HorizontalScrollPosition = " DWO code to make the DWO scroll. If it does, then the DC's scrollbars will autoamtically keep up. ;-)
If you are interested in this approach, please feel free to download the STD Framework's OrderEntry Demo App and use this code as your app needs. The framework is free and open source, so you can use the framework "as is" or utilize any PowerScript code that you see in your App as you require.
FYI: http://chrispollach.blogspot.com/2024/05/2024r2.html
If your testing the PB 2025 Beta product, then this framework version might also be of interest ..
http://chrispollach.blogspot.com/2024/10/2024r3.html
HTH
Regards .. Chris
Thank you for answer. It's very helpful. I checked your example, but I cannot open connection to database. I deployed SQL Serve instance database from your samples, but where I should be change DBConnection params ?
Can you help me?
Regards,
Pawel
Yes, the OrderEntry Demo App uses the Appeon PB Demo database. The connection parameters are handled via its OrderEntry INI file. The "SS01" section is used for SS DB connectivity. However, the connection settings are encrypted. So you need to use the INI Admin App provided in the demo app to manage the settings as it will save yours back to the OE INI file encrypted.
FYI: https://chrispollach.blogspot.com/2024/06/adminini.html
HTH
Regards ... Chris