Solved

CSliderCtrl notifications

Posted on 1997-05-17
2
809 Views
Last Modified: 2013-11-19
I have a dialogbar  with a slider control in it. Using ClassWizard, I added
handlers for the notification messages I was interested in.
I want those notifications to be handled by the CMainframe class owning the CDialogbar.

None of the notifications messages are dispatched for CsliderCtrl controls.  Also, I noticed that Windows is sending for example a WM_SETFOCUS message and not a NM_SETFOCUS message.  And even if it's a WM_SETFOCUS message, I can't trap it.

Do I need to add something to my code in order to ensure that the
notification messages are actually sent? Or do I need to add something to
the message map to handle the WM_ messages being sent to the control?  I would like to be able to trap WM_HSCROLL too wenever the user slides the track bar.

Best Regards,

Charles Bissonnette

0
Comment
Question by:biss
2 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 50 total points
ID: 1301616
A slider control notifies its parent window of user actions by sending the parent WM_HSCROLL messages. In your case, the parent window of the slider control is the CDialogbar. You should override CDialogbar::OnHScroll member function to transfer the message to the CMainframe.
void CDialogbar::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
    ::AfxGetMainWnd()->PostMessage(WM_HSCROLL, MAKEWPARAM(nSBCode, nPos), LPARAM(pScrollBar->GetSafeHwnd()));
}

0
 

Author Comment

by:biss
ID: 1301617
Thanks ,
 
I though every messages dispatched by a cdialogbar class were  routed directly to his host parent class.

Right now I catch the WM_NOTIFY messages and It seems to work fine, but it's very a pain in the neck since every messages are not only sent when you slide the track bar, but also every time  I lost the focus on the control.  This adds overhead for nothings.

And thanks for you tips,

Charles


0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now