Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Ownerdarw Combobox

Ownerdarw Combobox

Scheduled Pinned Locked Moved C / C++ / MFC
help
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AbhiHcl
    wrote on last edited by
    #1

    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..

    N A 2 Replies Last reply
    0
    • A AbhiHcl

      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..

      N Offline
      N Offline
      Nibu babu thomas
      wrote on last edited by
      #2

      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

      A 1 Reply Last reply
      0
      • N Nibu babu thomas

        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

        A Offline
        A Offline
        AbhiHcl
        wrote on last edited by
        #3

        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.

        N 1 Reply Last reply
        0
        • A AbhiHcl

          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.

          N Offline
          N Offline
          Nibu babu thomas
          wrote on last edited by
          #4

          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

          A 1 Reply Last reply
          0
          • N Nibu babu thomas

            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

            A Offline
            A Offline
            AbhiHcl
            wrote on last edited by
            #5

            In this line its giving assertion : void CComboBox::MeasureItem(LPMEASUREITEMSTRUCT) { ASSERT(FALSE); }

            A N 2 Replies Last reply
            0
            • A AbhiHcl

              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..

              A Offline
              A Offline
              Aescleal
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0
              • A AbhiHcl

                In this line its giving assertion : void CComboBox::MeasureItem(LPMEASUREITEMSTRUCT) { ASSERT(FALSE); }

                A Offline
                A Offline
                Aescleal
                wrote on last edited by
                #7

                This tells you exactly what's wrong - you haven't overidden MeasureItem in your derived class so MFC's telling you to go and do it rather than letting your code crash in a novel and interesting way later. Cheers, Ash

                1 Reply Last reply
                0
                • A AbhiHcl

                  In this line its giving assertion : void CComboBox::MeasureItem(LPMEASUREITEMSTRUCT) { ASSERT(FALSE); }

                  N Offline
                  N Offline
                  Nibu babu thomas
                  wrote on last edited by
                  #8

                  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

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups