Solved

Capturing Combobox messages

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Tab names are off by one 5 54
Complete beginner needs help making a cron job 9 129
countEvens challenge 2 113
sumHeights2  challenge 7 129
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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…
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.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

679 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