Edit

Share via


CPaneDialog Class

The CPaneDialog class supports a modeless, dockable dialog box.

Syntax

class CPaneDialog : public CDockablePane

Members

Public Constructors

Name Description
CPaneDialog::CPaneDialog Default constructor.
CPaneDialog::~CPaneDialog Destructor.

Public Methods

Name Description
CPaneDialog::Create Creates a dockable dialog box and attaches it to a CPaneDialog object.
CPaneDialog::CreateObject Used by the framework to create a dynamic instance of this class type.
CPaneDialog::GetThisClass Used by the framework to obtain a pointer to the CRuntimeClass object that is associated with this class type.
CPaneDialog::HandleInitDialog Handles the WM_INITDIALOG message. (Redefines CBasePane::HandleInitDialog.)
CPaneDialog::OnEraseBkgnd Handles the WM_ERASEBKGND message. (Redefines CWnd::OnEraseBkgnd.)
CPaneDialog::OnLButtonDblClk Handles the WM_LBUTTONDBLCLK message. (Redefines CWnd::OnLButtonDblClk.)
CPaneDialog::OnLButtonDown Handles the WM_LBUTTONDOWN message. (Redefines CWnd::OnLButtonDown.)
CPaneDialog::OnUpdateCmdUI Called by the framework to update the dialog box window. (Overrides CDockablePane::OnUpdateCmdUI.)
CPaneDialog::OnWindowPosChanging Handles the WM_WINDOWPOSCHANGING message. (Redefines CWnd::OnWindowPosChanging.)
CPaneDialog::SetOccDialogInfo Specifies the template for a dialog box that is an OLE control container.

Remarks

Construct a CPaneDialog object in two steps. First, construct the object in your code. Second, call CPaneDialog::Create. You must specify a valid resource template name or template ID and pass a pointer to the parent window. Otherwise, the creation process fails. The dialog box must specify the WS_CHILD and WS_VISIBLE style. We recommend that you also specify the WS_CLIPCHILDREN and WS_CLIPSIBLINGS styles. For more information, see Window Styles.

Inheritance Hierarchy

CObject

CCmdTarget

CWnd

CBasePane

CPane

CDockablePane

CPaneDialog

Requirements

Header: afxpanedialog.h

CPaneDialog::Create

Creates a docking dialog box and attaches it to a CPaneDialog object.

BOOL Create(
    LPCTSTR lpszWindowName,
    CWnd* pParentWnd,
    BOOL bHasGripper,
    LPCTSTR lpszTemplateName,
    UINT nStyle,
    UINT nID,
    DWORD dwTabbedStyle= AFX_CBRS_REGULAR_TABS,
    DWORD dwControlBarStyle=AFX_DEFAULT_DOCKING_PANE_STYLE);

BOOL Create(
    LPCTSTR lpszWindowName,
    CWnd* pParentWnd,
    BOOL bHasGripper,
    UINT nIDTemplate,
    UINT nStyle,
    UINT nID);

BOOL Create(
    CWnd* pParentWnd,
    LPCTSTR lpszTemplateName,
    UINT nStyle,
    UINT nID);

BOOL Create(
    CWnd* pParentWnd,
    UINT nIDTemplate,
    UINT nStyle,
    UINT nID);

Parameters

lpszWindowName
[in] The name of the docking dialog box.

pParentWnd
[in] Points to the parent window.

bHasGripper
[in] TRUE to create the docking dialog box with a caption (gripper); otherwise, FALSE.

lpszTemplateName
[in] The name of the resource dialog template.

nStyle
[in] The Windows style.

nID
[in] The control ID.

nIDTemplate
[in] The resource ID of the dialog template.

dwTabbedStyle
[in] The style of the tabbed window that results when the user drags another control pane onto the caption of this control pane. The default value is AFX_CBRS_REGULAR_TABS. For more information, see the Remarks section of the CBasePane::CreateEx method.

dwControlBarStyle
[in] Additional style attributes. The default value is AFX_DEFAULT_DOCKING_PANE_STYLE. For more information, see the Remarks section of the CBasePane::CreateEx method.

Return Value

TRUE if this method succeeds; otherwise, FALSE.

Remarks

Example

The following example demonstrates how to use the Create method in the CPaneDialog class. This example is part of the Set Pane Size sample.

CPaneDialog m_wndDlgBar;
// The this pointer points to a CMainFrame class which extends the CFrameWnd class.
if (!m_wndDlgBar.Create(_T("DialogBar"), this, TRUE,
                        MAKEINTRESOURCE(IDD_DLG_BAR),
                        WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI,
                        ID_VIEW_DLGBAR))
{
   TRACE0("Failed to create Dialog Bar\n");
   return FALSE; // fail to create
}

CPaneDialog::HandleInitDialog

Handles the WM_INITDIALOG message.

afx_msg LRESULT HandleInitDialog(
    WPARAM wParam,
    LPARAM lParam);

Parameters

wParam
[in] Handle to the control that is to receive the default keyboard focus.

lParam
[in] Specifies additional initialization data.

Return Value

TRUE if this method is successful; otherwise, FALSE. In addition, TRUE sets the keyboard focus to the control specified by the wParam parameter; FALSE prevents setting the default keyboard focus.

Remarks

The framework uses this method to initialize controls and the appearance of a dialog box. The framework calls this method before it displays the dialog box.

CPaneDialog::SetOccDialogInfo

Specifies the template for a dialog box that is an OLE control container.

virtual BOOL SetOccDialogInfo(_AFX_OCC_DIALOG_INFO* pOccDialogInfo);

Parameters

pOccDialogInfo
[in] Pointer to a dialog box template that is used to create the dialog box object. The value of this parameter is subsequently passed into the COccManager::CreateDlgControls method.

Return Value

Always TRUE.

Remarks

This method supports the COccManager class, which manages OLE control sites and ActiveX controls. The _AFX_OCC_DIALOG_INFO structure is defined in the afxocc.h header file.

See also

Hierarchy Chart
Classes
CDockablePane Class
Window Styles