...so the project is a bit huge and complex for just a test case...
I'll just comment on that, you should always be able to break a problem down to a smaller test case. So for something like you have described, my test case would be the code at the end of this post. The key points being a form that is taller than a screen, and an INPUT that takes you to the bottom of the screen when you want the top to remain visible. Sometimes for a test case you can start with the code from FGLDIR/demo. Also with simple test cases. you will sometimes find that as you prepare the test case you will find the magic line that is the difference between your production example doing what you expect and not what you expect.
Anyway sounds like you have hit upon the solution of putting a focusable field at the top of the page, my example shows a styles technique where you can make that field practically invisible.
My first thought was that you should be able to use the ui.Form.ensureFieldVisible method but as the test case shows that doesn't work in this instance. It is designed for widgets like FOLDER to ensure a certain page is visible and AFAIK does not have ability to move scrollbars, perhaps it should ...
ensureFieldVisible.4gl
MAIN
DEFINE field1, field2 STRING
DEFINE dummy STRING
DEFINE w ui.Window
DEFINE f ui.Form
OPTIONS INPUT WRAP
MENU ""
COMMAND "Default"
OPEN WINDOW w WITH FORM "ensureFieldVisible"
DISPLAY 100 TO field1
INPUT BY NAME field2;
IF int_flag THEN
LET int_flag = 0
END IF
CLOSE WINDOW w
COMMAND "ui.Form.ensureFieldVisible"
OPEN WINDOW w WITH FORM "ensureFieldVisible"
LET w= ui.Window.getCurrent()
LET f= w .getForm()
DISPLAY 200 TO field1
INPUT BY NAME field2
BEFORE INPUT
CALL f.ensureFieldVisible("formonly.field1")
END INPUT
IF int_flag THEN
LET int_flag = 0
END IF
CLOSE WINDOW w
COMMAND "dummy"
OPEN WINDOW dummy WITH FORM "ensureFieldVisible_dummy"
CALL ui.Interface.loadStyles("ensureFieldVisible.4st")
DISPLAY 300 TO field1
INPUT BY NAME dummy, field2
AFTER FIELD dummy
-- Can't tab back into dummy field once exit it
CALL DIALOG.setFieldActive("dummy", FALSE)
END INPUT
IF int_flag THEN
LET int_flag = 0
END IF
CLOSE WINDOW dummy
CALL ui.Interface.loadStyles("default") -- Resort to default style
ON ACTION close
EXIT MENU
END MENU
END MAIN
A stylesheet
ensureFieldVisible.4st
<?xml version="1.0" encoding="ANSI_X3.4-1968"?>
<StyleList>
<Style name=".dummy" >
<StyleAttribute name = "fontSize" value = "1pt" />
<StyleAttribute name = "border" value = "none" />
<StyleAttribute name = "textColor" value = "transparent" />
<StyleAttribute name = "backgroundColor" value = "transparent" />
</Style>
</StyleList>
and 2 forms
ensreFieldVisible.per
LAYOUT
VBOX
GRID
{
[f01 ]
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
}
END
FOLDER
PAGE
GRID
{
[f02 ]
}
END
END
END
END
END
ATTRIBUTES f01 = formonly.field1, NOENTRY;
ATTRIBUTES f02 = formonly.field2;
ensureFieldVisible_dummy.per
LAYOUT
VBOX
GRID
{
Stats [f01 ][x]
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
}
END
FOLDER
PAGE
GRID
{
[f02 ]
}
END
END
END
END
END
ATTRIBUTES
EDIT f01 = formonly.field1, NOENTRY, FORMAT="###,##&.&&";
EDIT f02 = formonly.field2;
EDIT X= formonly.dummy, STYLE="dummy"; -- the style minimises the ability to see the dummy field