ComboBox messages

I have a ComboBox that I want to do some special processing while the 
dropdown menu is down.  I know I can get a notification of CBN_DROPDOWN, but 
that only tells me when it is first dropped down.

I need to determine the selection the mouse is currently over in the drop 
down menu, so I can update a help balloon on the screen that will then 
describe what that choice will do.  (The user is choosing from various 
styles, and the balloon will give a short description of what each style is 
like.)

How can accomplish this end?  Is there a message I can grab that will tell 
me the mouse has moved over a new item in the list?

One thought I had was to activate a mouse-moved method when the drop-down is 
down, and then in the moved method check the current selection.  However, it 
appears that the selection is not changed until the user actually clicks on 
the item, so this is not a way to give info on the current item the user is 
hovering over.

Suggestions anyone? 


0
burt1 (32)
6/7/2005 1:33:15 AM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
1245 Views

Similar Articles

[PageSpeed] 24

Burt wrote:

> I have a ComboBox that I want to do some special processing while the 
> dropdown menu is down.  I know I can get a notification of CBN_DROPDOWN, but 
> that only tells me when it is first dropped down.
> 
> I need to determine the selection the mouse is currently over in the drop 
> down menu, so I can update a help balloon on the screen that will then 
> describe what that choice will do.  (The user is choosing from various 
> styles, and the balloon will give a short description of what each style is 
> like.)
> 
> How can accomplish this end?  Is there a message I can grab that will tell 
> me the mouse has moved over a new item in the list?
> 
> One thought I had was to activate a mouse-moved method when the drop-down is 
> down, and then in the moved method check the current selection.  However, it 
> appears that the selection is not changed until the user actually clicks on 
> the item, so this is not a way to give info on the current item the user is 
> hovering over.
> 
> Suggestions anyone? 
> 
> 

It will be a bit of work to do this, but you can detect which item is 
highlighted by the mouse by using the owner-draw style of combo box. 
With this style your DrawItem override will be called to paint each item 
in the box.  This is normally used for custom painting, such as to add 
an icon for each item.

The itemState that is passed to your DrawItem identifies which item is 
currently to be drawn highlighted.

-- 
Scott McPhillips [VC++ MVP]

0
Scott
6/7/2005 3:07:40 AM
I have done this. You do a simple owner-draw combo box, and in the OnDraw handler, when
you are drawing the selected item, you send a message to the parent indicating that there
has been a selection change. I did something like

GetParent()->SendMessage(UWM_SELECTION_CHANGED, (WPARAM)MAKELONG(GetDlgCttrlID(),
dis->itemID), (LPARAM)m_hWnd);

where UWM_SELECTION_CHANGED is a Registered Window Message. In the parent I do

ON_REGISTERED_MESSAGE(UWM_SELECTION_CHANGED, OnSelectionChanged)

LRESULT CMyDialog::OnSelectionChanged(WPARAM wParam, LPARAM)
   {
     ...handle popping up or changing the balloon help here...
     return 0;
   }


On Tue, 07 Jun 2005 01:33:15 GMT, "Burt" <burt@mindstorm-inc.com> wrote:

>I have a ComboBox that I want to do some special processing while the 
>dropdown menu is down.  I know I can get a notification of CBN_DROPDOWN, but 
>that only tells me when it is first dropped down.
>
>I need to determine the selection the mouse is currently over in the drop 
>down menu, so I can update a help balloon on the screen that will then 
>describe what that choice will do.  (The user is choosing from various 
>styles, and the balloon will give a short description of what each style is 
>like.)
>
>How can accomplish this end?  Is there a message I can grab that will tell 
>me the mouse has moved over a new item in the list?
>
>One thought I had was to activate a mouse-moved method when the drop-down is 
>down, and then in the moved method check the current selection.  However, it 
>appears that the selection is not changed until the user actually clicks on 
>the item, so this is not a way to give info on the current item the user is 
>hovering over.
>
>Suggestions anyone? 
>

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
6/7/2005 6:25:12 AM
Sounds perfect - thanks!

Interestingly, we finally got spy++ to look at a combo box this morning, and 
came up with the same possible solution.  I haven't yet implemented it yet, 
so your code is a great help. Thanks again!

"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message 
news:o7faa15n5nujd7m7rtgeqm1fcqgq0gc2pp@4ax.com...
>I have done this. You do a simple owner-draw combo box, and in the OnDraw 
>handler, when
> you are drawing the selected item, you send a message to the parent 
> indicating that there
> has been a selection change. I did something like
>
> GetParent()->SendMessage(UWM_SELECTION_CHANGED, 
> (WPARAM)MAKELONG(GetDlgCttrlID(),
> dis->itemID), (LPARAM)m_hWnd);
>
> where UWM_SELECTION_CHANGED is a Registered Window Message. In the parent 
> I do
>
> ON_REGISTERED_MESSAGE(UWM_SELECTION_CHANGED, OnSelectionChanged)
>
> LRESULT CMyDialog::OnSelectionChanged(WPARAM wParam, LPARAM)
>   {
>     ...handle popping up or changing the balloon help here...
>     return 0;
>   }
>
>
> On Tue, 07 Jun 2005 01:33:15 GMT, "Burt" <burt@mindstorm-inc.com> wrote:
>
>>I have a ComboBox that I want to do some special processing while the
>>dropdown menu is down.  I know I can get a notification of CBN_DROPDOWN, 
>>but
>>that only tells me when it is first dropped down.
>>
>>I need to determine the selection the mouse is currently over in the drop
>>down menu, so I can update a help balloon on the screen that will then
>>describe what that choice will do.  (The user is choosing from various
>>styles, and the balloon will give a short description of what each style 
>>is
>>like.)
>>
>>How can accomplish this end?  Is there a message I can grab that will tell
>>me the mouse has moved over a new item in the list?
>>
>>One thought I had was to activate a mouse-moved method when the drop-down 
>>is
>>down, and then in the moved method check the current selection.  However, 
>>it
>>appears that the selection is not changed until the user actually clicks 
>>on
>>the item, so this is not a way to give info on the current item the user 
>>is
>>hovering over.
>>
>>Suggestions anyone?
>>
>
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm 


0
burt1 (32)
6/7/2005 9:13:45 PM
Reply:

Similar Artilces:

combobox
hi i am trying to create a combobox containing a list of names i want the list to default to a "dummy" value when the workbook is opened How do i do this? thanks kevin You would need a macro for that, assume that you use the combo box from the control toolbox, and that the linked cell is A2 in Sheet2 Private Sub Workbook_Open() Worksheets("Sheet2").Range("A2").Value = "Your_Dummy_Value" End Sub Right click the little excel icon to the left of the filemenu and select view code or press Alt + F11 and double click ThisWorkbook That's where the ma...

How to avoid an Outlook message that pops up
Hi I have an Access macro that sends a different Access report to many different people on Outlook via a Send Object action within the Access macro. Yet each time the Send Object action is taken during the Access macro run, I get an Outlook message that states: "A program is trying to send an e-mail message on your behalf. If this is unexpected, click Deny...." I have to click the "Allow" button for each report to be sent while the macro runs...how can I avoid that and just have reports get sent via the Send Object action without me having to click Al...

Requery combobox
I have a form that includes a combobox that has the following in its on enter event: Private Sub cbProjectPhase_Enter() Me.cbProjectPhase.Requery End Sub The query that is tied to this combox uses another field ("Cost Center") on this form as criteria to select records for this combobox. It works fine except when I go to the next record and click on that combobox it removes what is showing in the previous record's combobox's field because my selection "Cost Center" is different this time. I understand why this happens but I don't know how to get around it. I...

SMTP
I am getting a wierd error on my SMTP in the DNS Messages Pending folder under the SMTP Queues. The error I am getting is all my postmaster messages are set to expire on 1/2/1601 with a Delivery Status Failure. I have restarted my SMTP service and it clears up the one in the current queue but it keeps generating new messages. Any thoughts or ideas would be greatly appreciated. Thanks in advance. -- Justin Justin wrote: > I am getting a wierd error on my SMTP in the DNS Messages Pending folder > under the SMTP Queues. > > The error I am getting is all my postmaster me...

Populate combobox
Hello Why doesn't this populate my ActiveX combobox? Private Sub ComboBox1_Change() Dim row As Integer ' Make sure the RowSource property is empty Sheet1!ComboBox1.RowSource = "" Sheet1!ComboBox1.RowSource = "Sheet1!A1:A12" ' Add some items to the ActiveX combobox For row = 1 To 12 Sheet1!ComboBox1.AddItem Sheets("Sheet1").Cells(row, 1) Next row End Sub Change the exclamation point (!) to a period (.) after Sheet1 everywhere except in the row source reference that is within the quote marks. &quo...

Outlook (only) keeps switching languages in the message editor.
Hello, One of our users has a problem with the language-settings in Outlook. The PC language has been installed as with an EN locale but the user has added FR and set it to be the default. When they open a new message in Outlook, the locale switches immediately switches back to EN for the message text. They can change it to FR on a per-message basis for the message text; however, the locale refuses to change when they click on the subject field. All the other Office applciation, e.g., Word, use FR without problems. The problem is only with Outlook. It's an Ex5.5 server (don't thin...

Debug Output Message
I am unsure what to do. I am receiving the following message: HEAP[NcicMdt.exe]: HEAP: Free Heap block ab4a50 modified at ab4a84 after it was freed This occurs during 'OnKillFocus' of a subclassed edit control: void ILclEdit::OnKillFocus() { if (m_ModifiedInd) { CString szTemp; GetWindowText(szTemp); <<=== This call MsgValidate(szTemp); } } The call stack is as follows: NTDLL! 77f75a58() NTDLL! 77f9d959() NTDLL! 77f83eb1() NTDLL! 77f589f2() _heap_alloc_base(unsigned int 64) line 200 _heap_alloc_dbg(unsigned int 22, int 1, const char * 0x5f4d0b18 THIS_FILE, int 118)...

How can I view all messages
I've just switcehd over from Lotus Notes and have previoulsy been able to view all messages, tasks , calendar items etc in one list. This is useful if you have filed a message and then forgotten wihich folder it is in. Can you do this in Outlook? Carl <Carl@discussions.microsoft.com> wrote: > I've just switcehd over from Lotus Notes and have previoulsy been > able to view all messages, tasks , calendar items etc in one list. > This is useful if you have filed a message and then forgotten wihich > folder it is in. Can you do this in Outlook? Nope. Advanced Searc...

Sending Messages on Behalf of another User
Is there a way to just sent a message on behalf of another users on your domain (in your company)? I don't want to have to go through the process of sharing eveyone's Email, I just want some users to be able to send an Email and it look like it's coming from another user. That way when the customer responds to the message it goes back to the original person, not the person who sent it. Nathan Goldberg wrote on Mon, 08 December 2008 18:56 > Is there a way to just sent a message on behalf of another users on your > domain (in your company)? I don't want to have to...

Message Box to Display a count of Records
I have the following code triggered by a button click on a form. The code is designed to search in a table and only retrieve the specific record or records. What I am interested in doing is that right after that click, the user will be visually notified of the number of total records found according to the criteria entered to be retrieved. Preferably a message saying something like, '5 accounts found'. Thanks! --------------------------------------------------------------------- Option Compare Database Private Sub Command19_Click() 'Purpose: Clear all t...

reply messages comes back to my inbox
I will reply to a message in my created inbox folders. I will send it and it will come back to my created folder and not to the original sender. ...

Help With Simple Combobox Programming
I have a combo box on sheet1. When the user clicks on the combo box the first time ( it gets focus ) It should add/load all items from sheet2 column A. Now when the user selects from the combobox that item should be copied/placed on sheet1.A5 similarly the next item selected in the combo box should be placed below A6 and so on How can this be accomplished with code thx Hi, Use code like that : Private Sub cboIn_Click() Dim intR As Integer intR = Range("a4").CurrentRegion.Rows.Count Range("a4").Offset(intR, 0).Value = cboIn.Value End Sub Priv...

combobox into another combobox
i got 2 combo boxes in a worksheet. i want to link the 2 combo boxes together. combo2 will depend on which is selected to the combo1. eg: combo1 - accessories, card, ram list in combo2 will vary on the item selected from the combo1. let say: combo1 - accessories have been selected combo2 - slot fan, usb to ps2 convertor. can someone helps me!!! thxns in advance Hi Take a look at Debra Dalgleish's site for lots of information on Data Validation http://www.contextures.com/xlDataVal13.html and for the section using Combo boxes http://www.contextures.com/xlDataVal10.html -- Regards ...

Filling More than one field a combobox selection
I have a simple Address Form Suburb, State, PostCode Suburb is a combobox linked to a Post code table What I would like to do is for the user to look up Suburb by typing into the combo box and populate the state and postcode fields on selection. Am I going about this the right way? See www.allenbrowne.com. He has an excellent search function exactly like you need. -- Milton Purdy ACCESS State of Arkansas "Avid Fan" wrote: > I have a simple Address Form Suburb, State, PostCode > > Suburb is a combobox linked to a Post code table > &...

OWA reply and original message disappears...
When you reply to a mail message using the Microsoft Outlook Web Access (OWA) Client, the original message disappears and the reply window does not appear. Therefore, you can not reply or forward any messages. Running Win XP with I.E. 6.0 SP1 ...

Help with ComboBox
Hi, I'm using Excel 2003 I have a spreadsheet using a ComboBox that allows selection of one of several sets of data. Each set is a 3 column row of data. I have the following properties set: BoundColumn: 2 TextColumn: 1 When a selection is made the ComboBox displays the column 1 value. The ComboBox seems to behave normally, except that when I close and open the file the combox initially displays the value of column 2 (instead of column 1). When a new selection is made it goes back to displaying the column 1 data. Shouldn't it always display the data as assigned by TextColu...

Outlook 2003: Stuck Message Followup Folder can't be deleted
Hi all, I have a message in my follow up folder that I can't delete. It's a message from with a virus warning that was removed by the mail server (I think - I can't open the message). It's old - it's been there since september. The message shows as unread, but it's not in any other folder. And of course I can't delete it. When I try I get: The item could not be deleted. It was either moved, or already deleted or access was denied. The message won't archive either... How do I get rid of this message? +++ Rick --- -- Rick Strahl West Wind Technologies htt...

Message still appears with DisplayAlerts = False & SaveChanges:=Fa
In an Excel 2003 macro, I have 3 workbooks, each of which I close with this code: ActiveWindow.Close SaveChanges:=False This has run for months without incident but now, in each instance, pops up a form entitled "Document modified," with the prompt: "The active document has been changed. Save Changes?" So, I added, before the Close method: "Application.DisplayAlerts = False". The message still appears when it hits the Close. The macro was originally written in Excel 2003 & all the workbooks invloved are Excel 97-2003 .xls files. How...

Error Message #30
Each time I open Outlook 2000, particularly in the Contacts folder an error message appears. "MICROSOFT OUTLOOK HAS EXPERIENCED AN ERROR AND WILL NEED TO CLOSE" I have sent several Error Message Reports and I can't seem to get a reply. Please help Open outlook and go to the help drop down and select detect and repair. I would try that first.... Hope that helps. >-----Original Message----- >Each time I open Outlook 2000, particularly in the >Contacts folder an error message appears. "MICROSOFT >OUTLOOK HAS EXPERIENCED AN ERROR AND WILL NEED TO CLOSE...

ActiveX message trapping
Hi I have an mfc doc/view app wherein the view conatins a custom child window. This child window further conatins an 3'rd party ActiveX control. I have handled some events such as OnSetCursor, etc in child window. Is there a way to trap messages that goes to ActiveX control, so that I can handle necessary messages (such as OnSetCursor) in child window itself rather than it being handled by ocx. How can this be acheived, is subclassing the only solution ? Thanks in advance Thangaraj A.L. got it ..... KB156051 "PRB: Messages Not Received by Dynamically Created Control" ...

How do you turn off a warning message
How do you turn of a warning message from coming up when an action button is clicked on during a slideshow? PowerPoint 2007 You shouldn't get a warning message. What have you got, "behind" the button? If nothing then perhaps this is why the warning is coming up. Right click on the Action Button (whilst in Normal View) / Edit Hyperlink - make sure that you have set up things correctly in here. If my comments have helped please hit Yes. Thanks. "bjebuckeye" wrote: > How do you turn of a warning message from coming up when an action ...

Opening messages saved in Outlook MSG format
I have saved some messages from a different computer using Outlook (98 I think) in MSG format. I am now trying to open them on a different computer with Outlook Express and can't seem to do so. The new computer doesn't have Outlook. I need to access some attahments saved within those e-mails. Any ideas? Thanks ...

how to combine multipart messages in outlook 2002
I was sent a large file as a set of multipart e-mail messages. Please let me know how to combine these messages to extract the file. Please email your response to sisira.jayasinghe@noraneng.com Thank you. Sisira Sisira Jayasinghe <sisira.jayasinghe@noraneng.com> wrote: > I was sent a large file as a set of multipart e-mail > messages. Please let me know how to combine these > messages to extract the file. Um, cut-and-paste? -- Brian Tillman Smiths Aerospace 3290 Patterson Ave. SE, MS 1B3 Grand Rapids, MI 49512-1991 Brian.Tillman is the name, smiths-aerospace.co...

Sorting messages by Subject
Somthing interesting in Outlook. When you select a message and then try to sort messages by subject by clicking on the subject column, the message you originally chose is no longer selected. It defaults to the first "sorted-by-subject" message in your inbox. THis is not he case when you sort by the From field or the Received field. The message you originally chose before the sort by these fields still remains selected. Is there any workaround to this? We have installed Office SP1. Thanks, Marita ...

Register my own messages
I'm trying to understand how to work with my own defined messages. I've readed the essays from http://www.flounder.com/mvp_tips.htm which I'm sure is very complet, is too technical for my level. I found an example at http://www.codersource.net/mfc_user_event.html but doesn't seems to work... I'm getting this error: "int CODERSOURCEMSG" (?CODERSOURCEMSG@@3HA) already defined in PostMessage01.obj Debug/PostMessage01.exe : fatal error LNK1169: one or more multiply defined symbols found I defined int CODERSOURCEMSG in a header file appart. I don't understand why...