Solved

Capturing Combobox messages

Posted on 1998-10-13
5
280 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
[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
  • 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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

617 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