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. Mobile Development
  3. Mobile
  4. Problem with Virtual List View

Problem with Virtual List View

Scheduled Pinned Locked Moved Mobile
helpc++htmldatabasecom
6 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.
  • B Offline
    B Offline
    Bui Huy Kien
    wrote on last edited by
    #1

    Dear all, I am writting a database application for Pocket PC 2002 using the eVC++ 3.0 Now, I have a problem that need to add a lot of items on the CListCtrl. I had tried following the article found on PocketPCDN about Virtual List View http://www.pocketpcdn.com/articles/list\_view.html but my program always displays an error message: "Assertion Failed Test: File winctrl2.cpp, Line 504" Here is my code to create the CListCtrl if(m_wndList.Create (WS_CHILD | WS_VISIBLE | LVS_OWNERDATA | LVS_SINGLESEL | LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER, CRect(0,0,243,224), this, MAIN_LIST)) { // Set List Control style to Full Row Select DWORD dwStyle = m_wndList.GetExtendedStyle(); dwStyle |= LVS_EX_FULLROWSELECT; m_wndList.SetExtendedStyle(dwStyle); } Any help is very appriciated. Regards, -BHKien

    D 1 Reply Last reply
    0
    • B Bui Huy Kien

      Dear all, I am writting a database application for Pocket PC 2002 using the eVC++ 3.0 Now, I have a problem that need to add a lot of items on the CListCtrl. I had tried following the article found on PocketPCDN about Virtual List View http://www.pocketpcdn.com/articles/list\_view.html but my program always displays an error message: "Assertion Failed Test: File winctrl2.cpp, Line 504" Here is my code to create the CListCtrl if(m_wndList.Create (WS_CHILD | WS_VISIBLE | LVS_OWNERDATA | LVS_SINGLESEL | LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER, CRect(0,0,243,224), this, MAIN_LIST)) { // Set List Control style to Full Row Select DWORD dwStyle = m_wndList.GetExtendedStyle(); dwStyle |= LVS_EX_FULLROWSELECT; m_wndList.SetExtendedStyle(dwStyle); } Any help is very appriciated. Regards, -BHKien

      D Offline
      D Offline
      Daniel Strigl
      wrote on last edited by
      #2

      It look like you have tried to call the SetItemText function of the CListCtrl class with the LVS_OWNERDATA style flag and if you take a look in the source code of winctrl2.cpp, Line 504 you will see an assert:

      BOOL CListCtrl::SetItemText(int nItem, int nSubItem, LPCTSTR lpszText)
      {
      ASSERT(::IsWindow(m_hWnd));
      ASSERT((GetStyle() & LVS_OWNERDATA)==0);
      LVITEM lvi;
      lvi.iSubItem = nSubItem;
      lvi.pszText = (LPTSTR) lpszText;
      return (BOOL) ::SendMessage(m_hWnd, LVM_SETITEMTEXT, nItem, (LPARAM)&lvi);
      }

      So, this function call is not allowed with the LVS_OWNERDATA style flag! Regards, Daniel. -- FIND A JOB YOU LOVE, AND YOU'LL NEVER HAVE TO WORK A DAY OF YOUR LIFE. ;)

      J 1 Reply Last reply
      0
      • D Daniel Strigl

        It look like you have tried to call the SetItemText function of the CListCtrl class with the LVS_OWNERDATA style flag and if you take a look in the source code of winctrl2.cpp, Line 504 you will see an assert:

        BOOL CListCtrl::SetItemText(int nItem, int nSubItem, LPCTSTR lpszText)
        {
        ASSERT(::IsWindow(m_hWnd));
        ASSERT((GetStyle() & LVS_OWNERDATA)==0);
        LVITEM lvi;
        lvi.iSubItem = nSubItem;
        lvi.pszText = (LPTSTR) lpszText;
        return (BOOL) ::SendMessage(m_hWnd, LVM_SETITEMTEXT, nItem, (LPARAM)&lvi);
        }

        So, this function call is not allowed with the LVS_OWNERDATA style flag! Regards, Daniel. -- FIND A JOB YOU LOVE, AND YOU'LL NEVER HAVE TO WORK A DAY OF YOUR LIFE. ;)

        J Offline
        J Offline
        Joao Paulo Figueira
        wrote on last edited by
        #3

        Daniel is right. Furthermore, to use the LVS_OWNERDATA style, you have to handle a number of notification messages, most notably: LVN_GETDISPINFO: Sent by the list control when it needs to render item data. LVN_ODCACHEHINT: If you have a cache with data, use this callback to prepare it. This message is received before LVN_GETDISPINFO, so you can prepare the cache with the requested data. LVN_ODFINDITEM: Used to find an item on the cache. LVN_ODSTATECHANGED: Cached items have changed their state. Regards, João Paulo Figueira Embedded MVP

        B 1 Reply Last reply
        0
        • J Joao Paulo Figueira

          Daniel is right. Furthermore, to use the LVS_OWNERDATA style, you have to handle a number of notification messages, most notably: LVN_GETDISPINFO: Sent by the list control when it needs to render item data. LVN_ODCACHEHINT: If you have a cache with data, use this callback to prepare it. This message is received before LVN_GETDISPINFO, so you can prepare the cache with the requested data. LVN_ODFINDITEM: Used to find an item on the cache. LVN_ODSTATECHANGED: Cached items have changed their state. Regards, João Paulo Figueira Embedded MVP

          B Offline
          B Offline
          Bui Huy Kien
          wrote on last edited by
          #4

          Thank you all, I have one more thing to ask: I am writting a derived class from CListCtrl. Is there any way to access the item data of the base class if my class use the LVS_OWNERDATA mode? Thanks for your help! -BHKien

          J 1 Reply Last reply
          0
          • B Bui Huy Kien

            Thank you all, I have one more thing to ask: I am writting a derived class from CListCtrl. Is there any way to access the item data of the base class if my class use the LVS_OWNERDATA mode? Thanks for your help! -BHKien

            J Offline
            J Offline
            Joao Paulo Figueira
            wrote on last edited by
            #5

            Remember: if you are deriving (public inheritance) from a CListCtrl it means that your class is a CListCtrl. So, everything is accessible. Regards, João Paulo Figueira Embedded MVP

            B 1 Reply Last reply
            0
            • J Joao Paulo Figueira

              Remember: if you are deriving (public inheritance) from a CListCtrl it means that your class is a CListCtrl. So, everything is accessible. Regards, João Paulo Figueira Embedded MVP

              B Offline
              B Offline
              Bui Huy Kien
              wrote on last edited by
              #6

              Thanks. -BHKien

              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