Controlling Virtual Data Form Scrolling

The number of rows and columns that the virtual form scrolls within the form window as the user moves from item to item is controlled by two form structure members: the horizontal scrolling quantity and the vertical scrolling quantity. No matter what the value of the scrolling quantity, if the next item is already displayed, the form is not adjusted within the window.

By default, both the horizontal and vertical scrolling quantities are set to MINIMUM. This means that the virtual form scrolls the least amount possible to get the next item and its prompt in the window. This means:

You can specify that you want the item to always appear left- or right-justified, in the center of the window, or at the top or bottom of the window.

Designer: See the Designer User's Guide for more information about adjusting virtual form scrolling quantities. The values listed in Table 14.1 can be used in the Designer. You can also adjust the scrolling quantities in your code, at any point after reading the form from the Designer library.

Code: To change the virtual form scrolling quantities in your code, call sfm_vadjq()

void sfm_vadjq(horzq, vertq, dfmp)
 
int horzq;
/* Horizontal amount to scroll
*/
int vertq;
/* Vertical amount to scroll
*/
DFORMPTR dfmp;
/* Pointer to virtual form
*/

The arguments horzq and vertq can be one of the #defined values listed in Table 14.1.

General: Instead of using one of the predefined values, you can set the scrolling quantities to specific values. When the window needs to be adjusted to show the current item, the window is scrolled the number of rows or columns specified.

Table 14.1: Horizontal and Scrolling Quantities for Virtual Forms

Scrolling Quantity Explanation
horzq  
MINIMUM Moves the minimum amount in the horizontal direction.
RTJUST Always right justifies the current field in the window.
LFTJUST Always left justifies the current field in the window.
CENTERFLD Always centers the item horizontally within the form window.
vertq  
MINIMUM Moves the minimum amount in the vertical direction.
PAGE Moves one page up or one page down when scrolling vertically.

Caution: Make sure that you specify form scrolling quantities that are appropriate for your form or the user interface will behave unpredictably. You should never specify a vertical scrolling quantity larger than the number of rows in the form window nor a horizontal scrolling quantity larger than the number of columns in the form window. If you do, the next item may not become immediately visible when the user moves to it.

More:

Making Field Prompts Visible When the Form Scrolls


Home Contents Previous Next