Scroll To Top of Form Window

Hello Everyone,

I have a Form Window with a Sheet and Tabs with ‘prop:wizard’ and ‘prop:nosheet’ enabled. When the user gets to tab 3 I am dynamically creating fields on the tab. The window has the ‘vscroll’ attribute enabled, the sheet has the ‘scroll’ attribute enabled and each of the dynamically created fields have the ‘scroll’ attribute enabled. The sheet height is set depending on how many fields are created on the tab. This is working perfectly except for when I load the next tab.

What happens is the next tab still has the new sheet height, instead of resetting to the default sheet height (set during window init) as I’m telling it to do when the tab changes in ‘Sheet > NewSelection’. The scroll thumb position is all the way at the bottom of the form instead of at the top of the form.

Ideally the next tab should be scrolled to the top and the scroll bar should be removed.

I have tried:

  1. Selecting a field at the top of the next tab but this doesn’t work.
  2. Setting the Window ‘vscroll’ property to 0. This removes the scroll bar but the form is still scrolled to the bottom of the new height and cuts off the fields at the top of the form.

There seems to be ways to do this in a browse but not on a form window. Does anyone know how to do this?

Regards,
Trent

Maybe you could use an IMAGE control as the parent of the created controls. (Doing that has its own set of display issues that are usually fixed well enough with InvalidateRect, though.)
What the image could give you is its own scroll bar in lieu of using the WINDOW scroll bar, so you could just resize the IMAGE within the SHEET’s TAB.

Worth a thought, anyway.

Try setting PROP:YOrigin to 0

2 Likes

Hi Leonid,

That did it! Thank you.

Regards,
Trent

2 Likes

Thanks Jeff, would have tried this if Leonid’s solution didn’t work.

Regards,
Trent