W
wgoldfarb
I am writing an Access application that takes the user through a script. The
interview is dynamic, so each answer determines what the subsequent questions
will be. Thus, the text (in the form of labels) and controls for upcoming
questions remain hidden and are only displayed when they are needed in the
script (code in each control's 'lost focus' event determines which question
should be next depending on previous results. The code then displays the
appropriate control by adjusting its vertical position, setting its visible
property to 'true' and giving it the focus).
The script is somewhat long, so the form where the script is contained is
much higher than the window that contains it. Thus, as the user progresses in
the script he/she needs to manually scroll down to be able to access the new
questions that are being displayed. I am trying to have the window scroll
automatically, so that each time the script reaches the bottom of the screen,
the form will automatically scroll up and the next question will appear at
the top of the screen.
My problem is that I cannot scroll the form with any degree of precision. I
have tried the following 4 calls to the Windows API:
lngRet = SendMessage(Me.hWnd, WM_VSCROLL, SB_LINEDOWN, 0&)
(calling it more than once, to scroll several lines)
lngRet = SendMessage(Me.hWnd, WM_VSCROLL, SB_PAGEDOWN, 0&)
lngRet = SendMessage(Me.hWnd, EM_LINESCROLL, 0, Lines&)
(where Lines& specifies the number of lines to scroll)
and even
intRet = SetScrollPos(Me.hWnd, SBS_VERT, intLines, True)
none of these seem to allow me to position the control with any accuracy at
the top of the window: they either scroll too much, or not nearly enough. In
the last case (SetScrollPos) the result is always the same regardless of the
number of lines I specify! what am I doign wrong? Is there any way to scroll
the window more precisely?
Thanks,
William
interview is dynamic, so each answer determines what the subsequent questions
will be. Thus, the text (in the form of labels) and controls for upcoming
questions remain hidden and are only displayed when they are needed in the
script (code in each control's 'lost focus' event determines which question
should be next depending on previous results. The code then displays the
appropriate control by adjusting its vertical position, setting its visible
property to 'true' and giving it the focus).
The script is somewhat long, so the form where the script is contained is
much higher than the window that contains it. Thus, as the user progresses in
the script he/she needs to manually scroll down to be able to access the new
questions that are being displayed. I am trying to have the window scroll
automatically, so that each time the script reaches the bottom of the screen,
the form will automatically scroll up and the next question will appear at
the top of the screen.
My problem is that I cannot scroll the form with any degree of precision. I
have tried the following 4 calls to the Windows API:
lngRet = SendMessage(Me.hWnd, WM_VSCROLL, SB_LINEDOWN, 0&)
(calling it more than once, to scroll several lines)
lngRet = SendMessage(Me.hWnd, WM_VSCROLL, SB_PAGEDOWN, 0&)
lngRet = SendMessage(Me.hWnd, EM_LINESCROLL, 0, Lines&)
(where Lines& specifies the number of lines to scroll)
and even
intRet = SetScrollPos(Me.hWnd, SBS_VERT, intLines, True)
none of these seem to allow me to position the control with any accuracy at
the top of the window: they either scroll too much, or not nearly enough. In
the last case (SetScrollPos) the result is always the same regardless of the
number of lines I specify! what am I doign wrong? Is there any way to scroll
the window more precisely?
Thanks,
William