질문하기질문하기
 

답변됨Trackbar Notifications

  • 2009년 7월 2일 목요일 오후 9:34lesnaubrTSC 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    I am trying to get some notification messages when a trackbar slider is moved and when the slider is released by releasing a mouse press.

    I am already getting the NM_RELEASEDCAPTURE notification when the mouse button is released. I cannot figure out what notification is sent when the trackbar thumb is moved.

    Thanks in advance.

답변

  • 2009년 7월 3일 금요일 오전 3:10Scott McPhillipsMVP사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨
    When the slider is moved with a mouse drag it sends WM_HSCROLL (or WM_VSCROLL) with nSBCode == TB_THUMBTRACK.

    When the user releases the slider it sends the same scroll message with nSBCode == TB_THUMBPOSITION.

모든 응답

  • 2009년 7월 3일 금요일 오전 3:10Scott McPhillipsMVP사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨
    When the slider is moved with a mouse drag it sends WM_HSCROLL (or WM_VSCROLL) with nSBCode == TB_THUMBTRACK.

    When the user releases the slider it sends the same scroll message with nSBCode == TB_THUMBPOSITION.
  • 2009년 7월 6일 월요일 오후 1:20lesnaubrTSC 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    I'm not sure why but I can never see those notifications occurring. I can see notifications such as NM_RELEASEDCAPTURE. Maybe I'm checking notifications on the wrong CWnd?

    In case it is important, This slider is part of a dialog window which is a child window of a save dialog.
  • 2009년 7월 6일 월요일 오후 1:57Scott McPhillipsMVP사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    You are seeing WM_NOTIFY messages, but the control also sends WM_HSCROLL (or WM_VSCROLL) messages.  Does your message handling intercept those messages?
  • 2009년 7월 6일 월요일 오후 2:30lesnaubrTSC 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    I have an OnNotify method that seems to intercept all of the WM_NOTIFY messages. I tried using an OnHScroll method but I still cannot get a TB_THUMBTRACK or TB_THUMBPOSITION message.
  • 2009년 7월 6일 월요일 오후 3:13Scott McPhillipsMVP사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     

    Show your code for OnHScroll.  Is it called?

     

  • 2009년 7월 6일 월요일 오후 3:44lesnaubrTSC 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     코드 있음
    Nothing is inside my OnHScroll function yet. I just have a variable assignment so that I can set a breakpoint to check if the function is called. It has not been called in my program but the OnNotify function continues to be called.

    void CAlphaImgFileSave::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
    {
       int i = 0;
    }

  • 2009년 7월 6일 월요일 오후 4:21lesnaubrTSC 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     코드 있음
    I think I just figured out my problem. It was a very small and stupid mistake on my part. I forgot to add:

    BEGIN_MESSAGE_MAP(CAlphaImgFileSave, CFileDialog)
       ON_WM_HSCROLL()
    END_MESSAGE_MAP()
  • 2009년 7월 6일 월요일 오후 4:28Scott McPhillipsMVP사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    The OnHScroll must be in the control's parent window.  Is your OnHScroll in the same class that receives the OnNotify?  Does that class have ON_WM_HSCROLL() in its message map?

  • 2009년 7월 6일 월요일 오후 4:38lesnaubrTSC 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    Yes, it is in the same class as OnNotify. At first, it was not in the message map. I noticed that mistake and pointed it out above. It was a dumb mistake on my part but I think my problem is solved now.

    Thanks!