Solved

ComboBox problem

Posted on 2000-04-01
5
318 Views
Last Modified: 2013-11-20
I have MyComboBox owner-draw control.
In OnDropDown I do SetCurSel(-1), because I want to scroll my window by myself. Then I post my user message.
I select an item in my user message (works OK), but after UserMessage has finished, item is unselected!!!! How could I select an item in UserMessage function?
I can't use SetCurSel or SetTopIndex because they autoscroll window.
Thanks all!

void CMyComboBox::OnDropdown()
{
   ...
   SetCurSel(-1);
   PostMessage(WM_USERMESSAGE);
}

void CODComboBoxDB::OnUserMessage(...)
{
   m_MyListBox.SetCurSel(x)
}
0
Comment
Question by:si124
5 Comments
 
LVL 1

Expert Comment

by:kkarunakar
ID: 2676404
Hello there,
In Place of message please try to add one function and try same.
If u r using message pls do PeekMessage also.
Try this.Hope this will work
U r comment is welcomed ..
Regards keshav
0
 

Author Comment

by:si124
ID: 2677462
Thank you for your help!
What did you mean "try to add one function"?
I don't know how to use PeekMessage in this case. Would you like to explain....
0
 

Author Comment

by:si124
ID: 2684887
Adjusted points from 100 to 150
0
 
LVL 3

Expert Comment

by:GlennDean
ID: 2685249
Hi si124:
   By any chance, did you add m_MyListBox via ClassWizard or did you manually add it?  IF you manually added it then you most likely forgot to add the necessary info into the DDX part of your class.  For example you should add to the DoDataExchange function something like
DDX_Control(pDX,IDC_COMBO1,m_MyListBox);
   Glenn  
0
 

Accepted Solution

by:
thirumaran earned 150 total points
ID: 2693017
Add GetFocus() function to bring the focus back to combobox
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now