Solved

Capturing Combobox messages

Posted on 1998-10-13
5
255 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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 video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

744 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

14 Experts available now in Live!

Get 1:1 Help Now