Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 292
  • Last Modified:

Capturing Combobox messages

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
Dex_Man
Asked:
Dex_Man
  • 2
  • 2
1 Solution
 
BridgeCommented:
ON_CBN_SELCHANGE(IDC_XXX, OnXXX)
afx_msg void OnXXX();      
0
 
Answers2000Commented:
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
 
Dex_ManAuthor Commented:
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
 
Answers2000Commented:
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
 
Dex_ManAuthor Commented:
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now