ImageGear for C and C++ on Linux v18.10 - Updated
IG_dspl_scroll_to
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Display Functions > IG_dspl_scroll_to

This function scrolls the image to a specified position and updates the window's scroll bars accordingly.

Declaration:

 
Copy Code
AT_ERRCOUNT  ACCUAPI  IG_dspl_scroll_to( 
        [IN] HIGEAR hIGear, 
        [IN] DWORD dwGrpID,
        [IN] HWND hWnd,
        [IN] INT nXPos,
        [IN] INT nYPos,
        [OUT] LPAT_SCROLL_INFO lpScrollInfo
);

Arguments:

Name Type Description
hIGear HIGEAR ImageGear handle of image.
dwGrpID DWORD Identifier of group where to work.
hWnd HWND Handle of window where image is drawn and scrolled.
nXPos INT New horizontal scroll position. Should be in a valid range that can be retrieved using the IG_dspl_scroll_get() function.
nYPos INT New vertical scroll position. Should be in a valid range that can be retrieved using the IG_dspl_scroll_get() function.
lpScrollInfo LPAT_SCROLL_INFO Where to copy the new scroll parameters. If NULL then the parameter is ignored.

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

All pixel formats supported by ImageGear for C and C++.

Example:

 
Copy Code
HIGEAR           hIGear;         /* HIGEAR handle of image   */ 
DWORD           nGrpID;          /* display group identifier  */
AT_SCROLL_INFO  ScrollInfo;    /* scroll info  */
 ...
/* scroll down and right from current position */
IG_dspl_scroll_get( hIGear, nGrpID, hWnd, NULL, &ScrollInfo );
If( (ScrollInfo.h_cur_pos<ScrollInfo.h_max) && (ScrollInfo.v_cur_pos<ScrollInfo.v_max) )
        IG_dspl_scroll_to( hIGear, nGrpID, hWnd, ScrollInfo.h_cur_pos+1,
ScrollInfo.v_cur_pos+1, NULL );

Remarks:

This function can be used even if a window's scroll bars are disabled. Both scroll positions should be in valid scroll range but if not, then the nearest valid value will be assigned.