Scroll to top after form is activated

R

Roman Mellenberger

Hi,

i want to scroll to the top of the control after parent form it is
activated. I use AutoScroll=true.
The problem is after the activated event the form isn't yet visible.
Is there a way to hook an event after the form is visible?

Thanks
Roman
 
P

Paul G. Tobey [eMVP]

I don't understand the question. Please define who is having AutoScroll set,
what the parent/child relationship between controls and forms is and what
exactly you're trying to achieve. After that, describe in detail what is
happening and why you think it's wrong.

Paul T.
 
R

Roman Mellenberger

I have the following constellation:

1. Form (AutoScroll: false)
2. User Control (Auto scroll: true)
3. User controls with textboxes (dynamically added)

The form is loaded and initially hidden. The user can navigate to this
form and perform some action. In normal case he will go from first to
the last control.
All I want do do is to focus the first of the textboxes and to scroll
to the top of the Control (2) if the form is deactivated and activated
and some other action is performed in the meantime.
I tried to do this in the 'activated' event but at this position the
form is not visible and therefore we have no scrollbar coordinates.

Thanks
Roman
 
P

Paul G. Tobey [eMVP]

I still don't understand where the problem comes in. In particular, "the
position of the form is not visible". What does that mean? Visibility
should have nothing to do with the scroll position of a panel/user control
that exists. I made a quick test using the WM5 emulator and a form with a
panel set for AutoScroll=true. I placed a TextBox near the top and another
near the bottom of the panel, well off-screen, if the panel is scrolled to
the top. When this form is activated, since the second text box is focused,
the panel is automatically scrolled to show it with no problem. Maybe
showing the code you've tried in the Activate event and failed with,
indicating what the values of variables are, what happened that was wrong,
etc. would help us understand.

Paul T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top