Solved

Capturing Combobox messages

Posted on 1998-10-13
5
260 Views
Last Modified: 2013-11-19
MSVC++ 5.0, MFC dialog based app

I have a combo box (dropdown) that I want to be able to see when it's updated so I can do other processing (namely, update the contents of another combo box).

What I thought I was to do, is capture the CBN_EDITCHANGE message, but it doesn't work. Help says this message doesn't occur on cbs_dropdownlist style of combo box, but cbs_dropdownlist isn't an option (in the editor) from what I can tell. Does this mean that it doesn't work on dropdown and Drop List style boxes, or something else? And if so, how else can I get this to work?

-Dex Man
0
Comment
Question by:Dex_Man
  • 2
  • 2
5 Comments
 
LVL 1

Expert Comment

by:Bridge
ID: 1323241
ON_CBN_SELCHANGE(IDC_XXX, OnXXX)
afx_msg void OnXXX();      
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1323242
1. Combo styles
- open dialog in resource editor
- right click on combo box
- click properties
- goto styles tab
- type combo box sets the style
Type = drop list = CBS_DROPDOWNLIST (a combo where you must pick - a drop down list + static)
type = dropdown = CBS_DROPDOWN ( a list + an edit)
type = simple = CBS_SIMPLE (a list which is always dropped, plus an edit)

2.CBN_SELCHANGE is sent for drop down list, it means they changed which item is picked.  Remember this is sent to the dialog containing the combo (but you can reflect it too)

3. CBN_EDITCHANGE and CBN_EDITUPDATE are only sent for combo's which include an edit control.  Again sent to dialog containing the combo (but you can reflect it too).  These messages are not sent for drop down list as this style doesn't include an edit control.
0
 
LVL 1

Author Comment

by:Dex_Man
ID: 1323243
Ok, so this works, except that it sends the message before the combo box is updated. I want to use the updated contents of the combo box to update another. So, I think I need to catpure a message AFTER it updates it? How do we do this, or how else would I get this to work?

-Dex Man

PS. Thanks ALOT for explaining the combo box styles, I've been wonding about that.
0
 
LVL 8

Accepted Solution

by:
Answers2000 earned 50 total points
ID: 1323244
1. CBN_EDITCHANGE is sent after the change occurs because of the user but before the screen/control is updated.  CBN_EDITUPDATE after both.

2. CBN_SELCHANGE is sent after the user changes the selection, but before the drop down lists closes up again, CBN_SELENDOK is sent after the list is closed up with the new selection.

Add this to my previous answer and I think you know how to do this - use CBN_SELENDOK
0
 
LVL 1

Author Comment

by:Dex_Man
ID: 1323245
Well, I got it to work. I used the Selchange, then grabbed the text selected instead of the field. There has to be an easier way to do it though, and so I'm thinking about SELENDOK, but will that also get changes made when the drop down isn't used? Like when someone arrows down to a different selection? Description of it in MFC makes me think not, so I hadden't tried it, but I will go ahead and try it.

Anyways, thanks a bunch for your help.

-Dex Man
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ADO Memory leak with DELPHI 2007 37 171
deburging in oracle form 12 89
Smart Camera scanning and reading information 3 100
SQUD PROXY SERVER, UNIX, SLL/HTTPS 5 77
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

863 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

27 Experts available now in Live!

Get 1:1 Help Now