• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 372
  • Last Modified:

ComboBox problem

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
si124
Asked:
si124
1 Solution
 
kkarunakarCommented:
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
 
si124Author Commented:
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
 
si124Author Commented:
Adjusted points from 100 to 150
0
 
GlennDeanCommented:
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
 
thirumaranCommented:
Add GetFocus() function to bring the focus back to combobox
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

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