Solved

Displaying Drop down List in CComboBox

Posted on 2003-11-17
1
239 Views
Last Modified: 2013-11-20
Hi
I have been trying to get a CComboBox with a Drop-List to show fonts. I think Ive done everything right but I still cant seem to see a full-drop down list. I get a very small list with 2 buttons for scrolling up and down and i can view only one of the items and not all.
Note that I also do FontComboBox.ShowDropDown(TRUE);

Please help !!

I created the combobox using the Resource View tab in Visual Studio.
The code in my OnInitDialog() is as show below:

BOOL ConfigDialog::OnInitDialog()
{
      //Load the fonts
      InstalledFontCollection *installedFontCollection =
            new InstalledFontCollection();

      // Get the count of FontFamily objects.
      int count = installedFontCollection->GetFamilyCount();
      cout<<"installedFontCollection :"<<count<<endl;

      FontFamily *fontFamilies ;
      FontFamily *loopFamilies ;
      fontFamilies = new FontFamily[count];

      int temp = 0;
      installedFontCollection->GetFamilies( count,fontFamilies,&temp );

      loopFamilies = fontFamilies;
      // loop and get all font family names.
      for(int j = 0; j < count; ++j)
      {
            WCHAR  familyName[LF_FACESIZE];
            cout<<"FamilyName::"<<familyName<<endl;
            loopFamilies->GetFamilyName(familyName,LANG_NEUTRAL);  
            CString name(familyName);
            cout<<"Name::"<<name<<endl;
            FontComboBox.AddString(name);
            loopFamilies++;
      }
      cout<<"No of items :"<<FontComboBox.GetCount()<<endl;

      FontComboBox.ShowDropDown(TRUE);

      return TRUE;  // return TRUE  unless you set the focus to a control
}

-P
0
Comment
Question by:prakash_gs
1 Comment
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 125 total points
Comment Utility
You can modify that in the Dialog resource itself

1. Place the Combo in dialog resource, so the selection will be in that control
2. Click on the drop arrow of the combo
3. Now you can see the selection has changed a little bit
4. Now Increase its hight by dragging the selection handle

Good Luck
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 85
Hibernate methods 2 58
tripleUp challenge 7 65
wordappend challenge 8 83
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
This video discusses moving either the default database or any database to a new volume.

762 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

12 Experts available now in Live!

Get 1:1 Help Now