which is the message sent to main window when the user clicks in a item of a combobox :?
Posted on 2002-06-10 10:38:49 by hunter
I'm pretty sure that it's CBN_SELENDOK but I haven't worked with a combobox in awhile. You can look it up in the win32api help file though.
Posted on 2002-06-10 12:06:43 by Will
Hi

You're looking for CBN_SELCHANGE I think...



...
.ELSEIF uMsg==WM_COMMAND

mov eax,wParam

...

.elseif ax==IDC_COMBOBOX1
shr eax, 16
.IF ax == CBN_SELCHANGE
;--------------------------------------------------------------------
; When the user changes the current selection in a combo box,
; the parent window receives a WM_COMMAND message with
; the notification message CBN_SELCHANGE in the high-order
; word of the wParam parameter. To determine the current
; selection, send the CB_GETCURSEL message to the combo box.
;--------------------------------------------------------------------

invoke SendMessage, hCombo, CB_GETCURSEL, 0, 0
; returns 0 based index




Kayaker
Posted on 2002-06-10 12:12:21 by Kayaker
Again, I haven't worked with comboboxes in awhile, but iirc CBN_SELCHANGE fires before the selection is actually made so you may get more than one of these messages before the user actually finishes his selection. What I mean is that say a user gives focus to the combobox and then scrolls through the drop down list to find the correct item to select. With CBN_SELCHANGE I believe that you'll get this message as each item gets scrolled through. But with CBN_SELENDOK you'll just get one message after the user finishes his selection.

....hope that makes sense.
Posted on 2002-06-10 14:48:59 by Will
Hi

I can't really see how either of these two notification messages are used any different programatically. I did a bit of testing for fun and they both seem to be called once when you select a combo box item, using either the CBS_DROPDOWNLIST or CBS_SIMPLE style of combo box.

MS goes into a long shpiel about the differences between the two, but on my system anyway I couldn't elicit a difference in response in how often or in what order the messages were processed while using the combo box. As far as that goes, neither did WS_EX_NOPARENTNOTIFY have the described effect:

;-------------------------------
An application could also process the notification messages CBN_SELENDOK and CBN_SELENDCANCEL. The system sends CBN_SELENDOK when the user selects a list item, or selects an item and then closes the list. This indicates the user has finished, and the selection should be processed. CBN_SELENDCANCEL is sent when the user selects an item, but then selects another control, presses the ESCAPE key while the drop-down list is open, or closes the dialog box. This indicates the user's selection should be ignored. In a simple combo box, CBN_SELENDOK is sent before every CBN_SELCHANGE message. If the WS_EX_NOPARENTNOTIFY window style is specified for the combo box, the system does not send CBN_SELENDOK and CBN_SELENDCANCEL messages.
;------------------------------

#define CBN_SELCHANGE 1
Notifies the change of the current selection.
The CBN_SELCHANGE notification code is sent when the user changes the current selection in the list box of a combo box.

#define CBN_SELENDOK 9
Notifies the selection of a list item.
The CBN_SELENDOK notification code is sent when the user has selected a list item.
;------------------------------


The two messages may have some differences under some conditions, but I couldn't detect any when using it with a regular combo box in a dialog.

Kayaker
Posted on 2002-06-10 16:25:02 by Kayaker
:)

I didn't mean to start an argument or anything. That's just what I remember from the api heip file the last time I had to use a combobox.

But thanks for taking the time to throw a test app together. That's a pretty good run down that you gave. I'll have to remember to search for this thread the next time I have to use a combobox.
Posted on 2002-06-10 16:49:43 by Will

:)

I didn't mean to start an argument or anything. That's just what I remember from the api heip file the last time I had to use a combobox.


Nothing of the sort was meant Will, I was just curious about its usage as well that's all ;-)
Posted on 2002-06-11 01:13:17 by Kayaker