tags:

views:

16

answers:

1

VS2008, 32 Bit Win XP

In a class derived from CFrameWnd, I have an object of CDialogBar that needs to have certain controls on it. Among these controls would be 2 sliders, whose event handling is to be done in CFrameWnd derived class. How shall I go about this?

class CFrameWndCustom : public CFrameWnd 
{ 
    CDialogBar m_wndDialogBar; // the CDialogBar object. 
} 

In CFrameWnd derived class's OnCreateClient, I have created the DialogBar using the above object like:

//Create the DialogBar 
if (!m_wndDialogBar.Create(this, 
                                        IDD_DIALOGBAR_CONTROL, 
                                        CBRS_BOTTOM, 
                                        IDD_DIALOGBAR_CONTROL)) 
{ 
        TRACE("Warning: Couldn't create DialogBar Control!\n"); 
        return FALSE; 
} 

Here, IDD_DIALOGBAR_CONTROL is a dialog resource with Style as Child. After this, I drag-dropped a CSliderCtrl on the IDD_DIALOGBAR_CONTROL in Resource View.

Now, how/where should I handle the CSliderCtrl's events? There would be 2 such slider controls.

I finally need the values of the sliders in CFrameWndCustom class.

best regards,

Divya

A: 

Derive your own CDialogBar class. Then handle all the messages in that. You won't even need to make it do anything but handle the message you want. The rest will get passed up the hierarchy.

Failing that you create your custom CDialogBar class and define your own OnWndMsg function and pass all WM_COMMAND or WM_NOTIFY messages on to the parent window.

Goz