Solved

Displaying Drop down List in CComboBox

Posted on 2003-11-17
1
251 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
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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
repeateFront java challenge 31 93
Adapt this command to show who installed 29 108
Replacement selected text 2 62
notReplace  challenge 53 131
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

831 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