Listbox items disappear
-
Hi I have an ownerdraw combobox I populate the entires thru the Drawitem method. When I click on the dropdown icon I can see the entries formatted in the right font However when I move the mouse over an item they start to disappear Hard for me to debug this because when I make a break point on Drawitem it goes thru the code after tracing the code and going back to the combo box the listbox hasn't dropped down This behavior only happens when I have a breakpoint on the Drawitem method Other wise when I remove it the listbox displays and I can see all the entries I added thanks
-
Hi I have an ownerdraw combobox I populate the entires thru the Drawitem method. When I click on the dropdown icon I can see the entries formatted in the right font However when I move the mouse over an item they start to disappear Hard for me to debug this because when I make a break point on Drawitem it goes thru the code after tracing the code and going back to the combo box the listbox hasn't dropped down This behavior only happens when I have a breakpoint on the Drawitem method Other wise when I remove it the listbox displays and I can see all the entries I added thanks
-
If you are interrupting the drawing process then that is probably what you would expect to see. The system erases the background and then expects your code to draw the entries. But if the drawing is prevented from happening it will show empty space.
I had the following lines around my draw
// if (pdi->itemAction == ODA_DRAWENTIRE)
// {SendMessage(pdi->hwndItem, CB\_GETLBTEXT, pdi->itemID, &text\[0\]); DrawText(pdi->hDC, (LPCTSTR)&text\[0\], -1, &pdi->rcItem, nFormat);
// }
Not sure when you click the dropdown ICN that you get ODA_SELECT and/or ODA_FOCUS Thanks
-
I had the following lines around my draw
// if (pdi->itemAction == ODA_DRAWENTIRE)
// {SendMessage(pdi->hwndItem, CB\_GETLBTEXT, pdi->itemID, &text\[0\]); DrawText(pdi->hDC, (LPCTSTR)&text\[0\], -1, &pdi->rcItem, nFormat);
// }
Not sure when you click the dropdown ICN that you get ODA_SELECT and/or ODA_FOCUS Thanks
You can use TRACE to see the exact value(s) of itemAction member.
-
I had the following lines around my draw
// if (pdi->itemAction == ODA_DRAWENTIRE)
// {SendMessage(pdi->hwndItem, CB\_GETLBTEXT, pdi->itemID, &text\[0\]); DrawText(pdi->hDC, (LPCTSTR)&text\[0\], -1, &pdi->rcItem, nFormat);
// }
Not sure when you click the dropdown ICN that you get ODA_SELECT and/or ODA_FOCUS Thanks
I am not sure that you should be using
CB_GETLBTEXT
to get your items for drawing. The usual process for an owner drawn control, is that you would have your list of items somewhere in your application. However, it is some while since I have done this so would need to review my code. -
I am not sure that you should be using
CB_GETLBTEXT
to get your items for drawing. The usual process for an owner drawn control, is that you would have your list of items somewhere in your application. However, it is some while since I have done this so would need to review my code.My process is that I do Addstring with values I have Then when clicking right icon dropdown on the combo box The Drawitem exit is invoked, allowing me to format that string with font, the rcitem RECT member has Dimensions from the MeasureItem exit the problem is at the end of stepping thru DrawItem the listbox remains intact non displayable. Victor Suggested I use TRACE have to look into that Thanks