Solved

Displaying Drop down List in CComboBox

Posted on 2003-11-17
1
264 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 125 total points
ID: 9769515
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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

627 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