Ownerdarw Combobox
-
Hi I want to create ownerdraw combobox. But whenever I m calling the create function its giving assertion error. Can anybody tell me why its happeing. here is code : void CTxComboBoxCtrl::CreateCustomComboBox(CRect rect, CWnd* pWnd, UINT nID) { this->Create(WS_CHILD|WS_VISIBLE|WS_BORDER|WS_HSCROLL|WS_VSCROLL|CBS_HASSTRINGS |CBS_DROPDOWNLIST |CBS_OWNERDRAWVARIABLE ,rect,pWnd,nID); } CTxComboBoxCtrl id derived from CComboBox class Thanks..
-
Hi I want to create ownerdraw combobox. But whenever I m calling the create function its giving assertion error. Can anybody tell me why its happeing. here is code : void CTxComboBoxCtrl::CreateCustomComboBox(CRect rect, CWnd* pWnd, UINT nID) { this->Create(WS_CHILD|WS_VISIBLE|WS_BORDER|WS_HSCROLL|WS_VSCROLL|CBS_HASSTRINGS |CBS_DROPDOWNLIST |CBS_OWNERDRAWVARIABLE ,rect,pWnd,nID); } CTxComboBoxCtrl id derived from CComboBox class Thanks..
You should override DrawItem function. Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com
-
You should override DrawItem function. Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com
-
ys I m overriding the ownerdraw function. but its giving arrestion error on the beginging its self when I m calling create function from oninitdialog funuction of the dailog.
Please show us the ASSERT code.
Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com
-
Please show us the ASSERT code.
Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com
-
Hi I want to create ownerdraw combobox. But whenever I m calling the create function its giving assertion error. Can anybody tell me why its happeing. here is code : void CTxComboBoxCtrl::CreateCustomComboBox(CRect rect, CWnd* pWnd, UINT nID) { this->Create(WS_CHILD|WS_VISIBLE|WS_BORDER|WS_HSCROLL|WS_VSCROLL|CBS_HASSTRINGS |CBS_DROPDOWNLIST |CBS_OWNERDRAWVARIABLE ,rect,pWnd,nID); } CTxComboBoxCtrl id derived from CComboBox class Thanks..
Quick hint: When the assertion fires you usually get the option to go to the line that triggered the assertion. Use a debugger when the assertion fires, have a dig around and try and relate the state of the code where you are to the parameters you passed into the Create function. It could be that you're trying to create a window with the same ID to one already in existence in a dialogue box (in which case you might need to subclass an existing control instead) or the style parameters don't work for this class. The trouble is we have no idea why/where this is happening as you can go straight to the code causing the problem and get an idea without much effort. Cheers, Ash
-
In this line its giving assertion : void CComboBox::MeasureItem(LPMEASUREITEMSTRUCT) { ASSERT(FALSE); }
-
In this line its giving assertion : void CComboBox::MeasureItem(LPMEASUREITEMSTRUCT) { ASSERT(FALSE); }
Since you've given CBS_OWNERDRAWVARIABLE as combo style, you need override MeasureItem.
Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com