Scrolling with the Data Rows of a Scrollable Region

To scroll another virtual form containing data row labels or other information with the data rows of a scrollable region, you write and install a scrollable region scrolling function.

The scrollable region scrolling function is called whenever the user scrolls the data rows in the scrollable region. The system passes to the function the change in the user's row position and the current scrollable region pointer. The function should return TRUE for success and FALSE for failure. A FALSE return should be reserved for unrecoverable errors, because returning FALSE causes form processing to terminate.

The call for your scrollable region scrolling function should be as follows:

int my_srscrlfp(delta_rowq, dfmp)

int delta_rowq;            /* Change in rows                */

DFORMPTR dfmp;            /* Pointer to current form        */

A negative number passed for delta_rowq indicates that the user scrolled up.

Designer: You can install the scrollable region scrolling function from within the Designer. See the Designer User's Guide for more information. You can also install the scrolling function in your code, by calling the function ssr_scrlfp() at any point after you have read the form from the Designer library. Refer to the tutorial program dspreadsheet.c for a complete example of an application that uses scrollable region scrolling functions.

Code: To install the scrollable region scrolling function in the system, call the function ssr_scrlfp():

void ssr_scrlfp(scrl_fp, srp)

int (*scrl_fp)();            /* Scrolling function to install        */

SRPTR srp;                /* Pointer to scrollable region        */

In the example above, the scrolling function should scroll the virtual form in the appropriate direction for the appropriate number of rows.

You should refer to the tutorial program spreadsheet.c for a complete example. For more information about writing and installing user functions, see Chapter 31, "Writing User Functions."


Home Contents Previous Next