Re: Automatic Form Scrolling
see my other posting, also for your question
You can catch the GotFocus event and try to adjust the scrollbar value, which will automatically scroll the control into view
RK
Re: Automatic Form Scrolling
Hi Freddie,
I did manage to solve my problem "Scrolling Forms", but by using a crude method. While looking for information regarding my problem, I came across an ocx "cScrollBars" which attempted a solution for the same problem. I am giving details below.
Name: cScrollBars
Author: Steve McMahon ([email protected])
Date: 24 December 1998
Requires: SSUBTMR.DLL
---------------------------------------------------------------------------
Copyright ® 1998 Steve McMahon ([email protected])
Visit vbAccelerator - free, advanced source code for VB programmers.
http://vbaccelerator.com
However, I used a slightly different approach. I put a picture box on all my forms and created a set of functions to implement scrolling
SFAdd(xForm As Form,xFrame As Object) - Add a form for scrolling
SFDel(hWnd As Long) - Delete a window for scrolling
I maintained a separate array of forms to scroll and subclassed them in SFAdd() to do automatic scrolling. All I had to do is to call SFAdd() in Load event and SFDel() in UnLoad event. SFAdd() would automatically move all controls on the form into the object usually a PictureBox control specified with SFAdd() as xFrame. All handling for Form resize was handled automatically through the subclassed procedure.
That goes for my solution to my problem. As for your problem I wish that there was something akin to "FocusChanged" event wherein we could put code to scroll the window automatically, thus bringing the required window area into view. The closest we can simulate this functionality is by using a Timer to trigger at regular intervals and see if the ActiveControl on the form is visible or not. If the control is not visible we can scroll the window ourselves without bothering the user, just as you want it.
Please let me know if my suggestion works, I haven't yet tried it. I would also like to implement this functionality, now that you have mentioned it.
Best Of Luck,
Girish Chandra
PS: You can get to me directly by e-mailing at "[email protected]". Don't forget to mention my name in Subject area.