UpdatePanningFeedback function

Triggers repositioning on a window's position when a user pans past a boundary.

Syntax


BOOL WINAPI UpdatePanningFeedback(
  _In_  HWND hwnd,
  _In_  LONG lTotalOverpanOffsetX,
  _In_  LONG lTotalOverpanOffsetY,
  _In_  BOOL fInInertia
);

Parameters

hwnd [in]

A handle to the window that will have boundary feedback on it.

lTotalOverpanOffsetX [in]

Indicates how far past the horizontal end of the pannable region the pan has gone.

lTotalOverpanOffsetY [in]

Indicates how far past the vertical end of the pannable region the pan has gone.

fInInertia [in]

A flag indicating whether the boundary feedback incorporates inertia.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, use the GetLastError function.

Remarks

Panning feedback causes the window that is being manipulated to have a visual cue when a user reaches the end of a pannable area. The window may also give the user feedback if they attempt to drag it beyond the pannable region.

Note  The fInInertia parameter should be TRUE when handling movements that are the result of inertia rather than finger movement.

To calculate the overpan values, take the virtual size of the overpan and then convert that to screen coordinates.

Examples


    case WM_GESTURE:        
        // Get all the vertial scroll bar information
        si.cbSize = sizeof (si);
        si.fMask  = SIF_ALL;
        GetScrollInfo (hWnd, SB_VERT, &si);
        yPos = si.nPos;

        ZeroMemory(&gi, sizeof(GESTUREINFO));
        gi.cbSize = sizeof(GESTUREINFO);
        bResult = GetGestureInfo((HGESTUREINFO)lParam, &gi);

        if (bResult){
            // now interpret the gesture            
            switch (gi.dwID){
                case GID_BEGIN:
                   lastY = gi.ptsLocation.y;
                   CloseGestureInfoHandle((HGESTUREINFO)lParam);
                   break;                     
                // A CUSTOM PAN HANDLER
                // COMMENT THIS CASE OUT TO ENABLE DEFAULT HANDLER BEHAVIOR
                case GID_PAN:                                                  
                    
                    si.nPos -= (gi.ptsLocation.y - lastY) / scale;

                    si.fMask = SIF_POS;
                    SetScrollInfo (hWnd, SB_VERT, &si, TRUE);
                    GetScrollInfo (hWnd, SB_VERT, &si);                                                        
                                               
                    yOverpan -= lastY - gi.ptsLocation.y;
                    lastY = gi.ptsLocation.y;
                     
                    if (gi.dwFlags & GF_BEGIN){
                        BeginPanningFeedback(hWnd);
                        yOverpan = 0;
                    } else if (gi.dwFlags & GF_END) {
                        EndPanningFeedback(hWnd, TRUE);
                        yOverpan = 0;
                    }
                           
                    if (si.nPos == si.nMin || si.nPos >= (si.nMax - si.nPage)){                    
                        // we reached the bottom / top, pan
                        UpdatePanningFeedback(hWnd, 0, yOverpan, gi.dwFlags & GF_INERTIA);
                    }
                    ScrollWindow(hWnd, 0, yChar * (yPos - si.nPos), NULL, NULL);
                    UpdateWindow (hWnd);                    
                                        
                    return DefWindowProc(hWnd, message, lParam, wParam);
                case GID_ZOOM:
                   // Add Zoom handler 
                   return DefWindowProc(hWnd, message, lParam, wParam);
                default:
                   // You have encountered an unknown gesture
                   return DefWindowProc(hWnd, message, lParam, wParam);
             }          
        }else{
            DWORD dwErr = GetLastError();
            if (dwErr > 0){
                // something is wrong 
                // 87 indicates that you are probably using a bad
                // value for the gi.cbSize
            }
        } 
        return DefWindowProc (hWnd, message, wParam, lParam);


Requirements

Minimum supported client

Windows 7 [desktop apps only]

Minimum supported server

Windows Server 2008 R2 [desktop apps only]

Header

Uxtheme.h (include Uxtheme.h)

Library

UxTheme.lib

DLL

UxTheme.dll

See also

Improving the Single Finger Panning Experience
BeginPanningFeedback
EndPanningFeedback
Functions

 

 

Community Additions

ADD
Show:
© 2015 Microsoft