Link to home
Start Free TrialLog in
Avatar of si124
si124

asked on

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)
}
Avatar of kkarunakar
kkarunakar

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
Avatar of si124

ASKER

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....
Avatar of si124

ASKER

Adjusted points from 100 to 150
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  
ASKER CERTIFIED SOLUTION
Avatar of thirumaran
thirumaran

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial