Announcement

Collapse
No announcement yet.

Refresh Child windows while Scrolling...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Refresh Child windows while Scrolling...

    Last question for the day.

    I have this code in my WM_HSCROLL:

    Code:
      Local SB As SCROLLINFO
      Local RC As Rect
      Local Xscroll As Long
      Local PosOld As Long
      Local PosNew As Long
      Local hWndPos As Dword
    
      SB.cbSize = SizeOf(SB)
      SB.fMask  = %SIF_RANGE Or %SIF_PAGE Or %SIF_POS
     
      Call GetScrollInfo(hWndForm, %SB_HORZ, SB)
     
      PosOld = SB.nPos
    
       Select Case nScrollCode
          Case %SB_LINELEFT
              If SB.nPos > SB.nMin Then Decr SB.nPos
              
          Case %SB_LINERIGHT
              If SB.nPos < SB.nMax Then Incr SB.nPos
              
          Case %SB_THUMBPOSITION
                 SB.nPos = nPosition
    
          Case %SB_PAGELEFT
              If SB.nPos > SB.nMin + 384 Then 
                 SB.nPos = SB.nPos - 384
              Else
                 SB.nPos = SB.nMin
              End If   
              
          Case %SB_PAGERIGHT
              If SB.nPos < SB.nMax - 384 Then 
                 SB.nPos = SB.nPos + 384
              Else
                 SB.nPos = SB.nMax
              End If
                            
          Case %SB_ENDSCROLL
               SB.nPos = GetScrollPos(hWndForm, %SB_HORZ)
               
       End Select
       
     PosNew = SB.nPos
      
     Call GetClientRect(hWndForm, RC)
     
     Xscroll = (PosOld - PosNew)
      
     Call SetScrollInfo(hWndForm, %SB_HORZ, SB, %false)
    
     Call ScrollWindowEx(hWndForm, XScroll, 0, ByVal %Null, RC, %Null, ByVal %Null, %SW_INVALIDATE Or %SW_SCROLLCHILDREN)
     
     Call UpdateWindow(hwndForm)
     
     Call SendMessage(hWNdForm, %WM_PAINT, 0, 0)
    It works fine, except it doesnt update while moving the scrollbar. It refreshes
    until i release the mouse button.

    Any idea how can i force it to refresh while scrolling? i want to be able to see
    the contents of the window while scrolling.

    Thanx in advance.

  • #2
    Code:
    Call UpdateWindow(hwndForm)
    Call SendMessage(hWNdForm, %WM_PAINT, 0, 0)
    I know you don't want to send WM_PAINT. That is NEVER sent. Besides, UpdateWindow() posts a WM_PAINT to the message queue so that gets picked up next time messages are retrieved.

    That said, when you process WM_HSCROLL:
    Return Value

    If an application processes this message, it should return zero.
    You doing that? (Code not shown).

    MCM
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      Perhaps you need to be processing %SB_THUMBTRACK ?

      SB_THUMBPOSITION
      The user has dragged the scroll box (thumb) and released the mouse button. The high-order word indicates the position of the scroll box at the end of the drag operation.

      SB_THUMBTRACK
      The user is dragging the scroll box. This message is sent repeatedly until the user releases the mouse button. The high-order word indicates the position that the scroll box has been dragged to.
      Last edited by Dave Biggs; 31 Dec 2008, 09:01 AM.
      Rgds, Dave

      Comment


      • #4
        Instead of UpdateWindow use:

        RedrawWindow

        You can use this API to immediately redraw a window and its child windows.
        Chris Boss
        Computer Workshop
        Developer of "EZGUI"
        http://cwsof.com
        http://twitter.com/EZGUIProGuy

        Comment


        • #5
          Disregard:
          Im Impressed of the teamwork... it was a matter of removing the WM_PAINT, processing %SB_THUMBTRACK and using Redrawwindow!!!.

          Thanx everyone!
          Last edited by Elias Montoya; 31 Dec 2008, 02:01 PM.

          Comment

          Working...
          X