Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MFC  , mdi forms

Posted on 2001-06-11
4
Medium Priority
?
359 Views
Last Modified: 2013-11-20
can we place a combo box on mdi form,,, if not why
0
Comment
Question by:chilappak
  • 2
4 Comments
 
LVL 42

Expert Comment

by:Meir Rivkin
ID: 6177637
u mean on the main frame's toolbar or just on one of the child windows, or maybe on the view....?
0
 
LVL 3

Expert Comment

by:GlennDean
ID: 6179739
IF you want to put a combo box on the view in an MDI application, here's how to do that:
1.  Insert a new class called CMyComboBox, and have it inherit CComboBox
2.  In the view class, add a variable
   CMyComboBox m_CB
3.  In the view's OnInitialUpdate, go

void CMyView::OnInitialUpdate()
{
  CView::OnInitialUpdate();
     
  #define WS_STD    (WS_BORDER|WS_CHILD)
  #define WS_BUTTON (BS_DEFPUSHBUTTON|WS_CHILD)

  CRect rect(0,0,150,200);
  BOOL bCBCreated = m_CB.Create(WS_STD|CBS_DROPDOWN|WS_VSCROLL, rect,
this, IDC_VIEWCLASS_COMBOBOX);

  if (bCBCreated)
  {
    m_CB.ShowWindow(SW_SHOWNORMAL);
  }
}

  Glenn
0
 
LVL 3

Accepted Solution

by:
GlennDean earned 200 total points
ID: 6179773
Forgot to tell you what IDC_VIEWCLASS_COMBOBOX is.  
1.  Go into the Resource.h file and record the
_APS_NEXT_CONTROL_VALUE (in a default MDI app it should be 1000)
2.  Add the line
#define IDC_VIEWCLASS_COMBOBOX "the recorded value from step 1"

3.  Add 1 to the _APS_NEXT_CONTROL_VALUE

4.  The new Resource.h should look something like
#define IDD_ABOUTBOX                    100
#define IDR_MAINFRAME                    128
#define IDR_JUN112TYPE                    129
#define IDC_VIEWCLASS_COMBOBOX          1000

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS               1
#define _APS_NEXT_RESOURCE_VALUE     130
#define _APS_NEXT_CONTROL_VALUE          1001
#define _APS_NEXT_SYMED_VALUE          101
#define _APS_NEXT_COMMAND_VALUE          32771
#endif
#endif
0
 

Author Comment

by:chilappak
ID: 6184558
thank u . i am  a beginer in vc++
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
Loops Section Overview

926 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