CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Posts
    34

    The step of creating a DialogBar

    What's the step of creating a CDialogBar object? Should I assign a new class to it?

    I create a dialog bar and place a button control on it. After this, I write the code of the click event. But the button doesn't enable when I execute the program. What's wrong with it?


  2. #2
    Join Date
    May 1999
    Posts
    12

    Re: The step of creating a DialogBar

    Hi,
    All you have to do is add the dialogbar component to your project from the Project-->Add to Project-->Components and controls. This is the fastest way to show a dialog bar without coding at all. Once you have added it you can check out your mainfrm.cpp for the implementation details.

    About the button not getting enabled. As far as my knowledge goes, controls in the dialog bar send a WM_COMMAND to the mainframe. You'll have to add the message handler yourselves.
    In the mainfrm.cpp add the ON_COMMAND Macro
    BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
    ON_COMMAND_EX(CG_ID_VIEW_MYDIALOGBAR, OnBarCheck)
    ON_UPDATE_COMMAND_UI(CG_ID_VIEW_MYDIALOGBAR, OnUpdateControlBarMenu)
    //{{AFX_MSG_MAP(CMainFrame)
    // NOTE - the ClassWizard will add and remove mapping macros here.
    // DO NOT EDIT what you see in //these blocks of generated code !
    ON_WM_CREATE()
    //}}AFX_MSG_MAP
    ON_COMMAND(IDC_BUTTON_TEST,OnTest)//macro //added
    END_MESSAGE_MAP()

    Later declare the OnTest in the .h file
    afx_msg void OnTest();
    in the .cpp implement it
    void CMainFrame::OnTest()
    {
    AfxMessageBox("test");

    }
    I hope this helps


  3. #3
    Join Date
    May 1999
    Posts
    34

    Re: The step of creating a DialogBar

    Thanks for your reply.
    But do you know how about to add a OCX in a dialog bar?


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured