Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Custom ComboBox in DialogBar

Posted on 1999-07-14
11
Medium Priority
?
454 Views
Last Modified: 2013-11-20
I've created a DialogBar that I would like to emulate the font drop-down list as in MS Word.  I have obtained a class from CodeGuru, named CustComboBox by Girish Bharadwaj.

I have subclassed the CDialogBar to CFontDlgBar, where I have added the member variables for the combo boxes, one of which is the CustComboBox.

The problem is that while the contructor for the CustComboBox is getting called correctly, nothing else is.  OnCreate is not getting called, and the overridden DrawItem, etc are not getting called.

Does anyone have any idea of what I'm doing wrong or missing, I'm lost.

thanks
0
Comment
Question by:Nevering
[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
11 Comments
 

Expert Comment

by:Recez
ID: 1309979
the combo box must be an owner-draw combo box
0
 
LVL 1

Author Comment

by:Nevering
ID: 1309980
It is owner drawn.. Set to Variable in rc, and Has Strings.


0
 
LVL 12

Expert Comment

by:migel
ID: 1309981
Hi!
Do you attach your MFC class to the windows control by SubclassDlgItem or DDX_Control?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Expert Comment

by:migel
ID: 1309982
Hm! A`m miss! You create DialogBar! its sligtly differ from creating Dialog. You must handle WM_INITIALUPDATE message in the your class and call here SubclassDlgItem method of the your ComboBox
0
 
LVL 1

Author Comment

by:Nevering
ID: 1309983
WM_INITIALUPDATE doesn't seem to be available (in Wizard) in my DialogBar class.  I tried OnInitDialog, which was there, but that didn't work for DialgBar.  And it's the CustComboBox that I want to SubClassDlgItem on .. right ?  Then who handles the messages?  ... the DialogBar class ?

thanks
0
 

Expert Comment

by:liaobin
ID: 1309984
I think before you subclass dialog, the combbox in dialog
template have been created, so it couldn't receive
wm_create message again.
I think perhaps you try following code:
   CCombbox* pwnd = (CCombobox*)m_dialogbar.GetDlgItem(IDC_COMBOX1);
   pwnd->InsertString(...)
         
0
 
LVL 12

Expert Comment

by:migel
ID: 1309985
Hm, But WM_INITIALUPDATE is sended to the dialog by Frame!
to add handler to it just modify your MESSAGE MAP
for example:
//in the class declaration define handler of this message
{
///....
afx_msg LRESULT OnInitialUpdate(WPARAM, LPARAM );
///.....
}

// in the cpp file
BEGIN_MESSAGE_MAP(....)
// wizard generated entries
....
//
 ON_MESSAGE(WM_INITIALUPDATE , OnInitialUpdate)
END_MESSAGE_MAP();

// implementation
LRESULT CMyDialogBar::OnInitialUpdate(WPARAM, LPARAM)
{
if (!m_wndCombo.GetSafeHwnd())
   m_wndCombo.SubclassDlgItem(IDC_COMBO, this);
}
0
 
LVL 1

Author Comment

by:Nevering
ID: 1309986
WM_INITIALUPDATE is undefined during compile ??
0
 
LVL 12

Expert Comment

by:migel
ID: 1309987
#include <afxpriv.h>
0
 
LVL 1

Author Comment

by:Nevering
ID: 1309988
Migel, that seemed to have worked, please answer the question so that I can give you the points.

thanks
Nevering
0
 
LVL 12

Accepted Solution

by:
migel earned 400 total points
ID: 1309989
Good luck!
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Suggested Courses

670 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