Solved

ComboBox problem

Posted on 2000-04-01
5
342 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expand macro to ask for filename column 8 37
notReplace  challenge 53 142
wait notify demo infinite loop 3 124
Modbus - whats the maximum I can store in one register? 4 80
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

837 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