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 Control in the Emulator of Pocket PC

Problem with Virtual List Control in the Emulator of Pocket PC

Scheduled Pinned Locked Moved Mobile
helpc++
5 Posts 2 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 had tried to use List Control in Virtual List mode using eVC 3.0. But I met a problem that I cannot solve. The problem is when I click on the list item of the List (my program run in the Pocket PC Emulator), I got an error message "Assertion failed. TestProg: File winctrl2.cpp, Line 479" But with that program, I run it on a Pocket PC, nothing happen when I click on List item. Please tell me what I did wrong. Thank you very much in advance.

    J 1 Reply Last reply
    0
    • B Bui Huy Kien

      Dear all, I had tried to use List Control in Virtual List mode using eVC 3.0. But I met a problem that I cannot solve. The problem is when I click on the list item of the List (my program run in the Pocket PC Emulator), I got an error message "Assertion failed. TestProg: File winctrl2.cpp, Line 479" But with that program, I run it on a Pocket PC, nothing happen when I click on List item. Please tell me what I did wrong. Thank you very much in advance.

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

      Bui Huy Kien wrote: Please tell me what I did wrong. You forgot to set the LVS_OWNERDATA window style. Regards, João Paulo Figueira Embedded MVP

      B 1 Reply Last reply
      0
      • J Joao Paulo Figueira

        Bui Huy Kien wrote: Please tell me what I did wrong. You forgot to set the LVS_OWNERDATA window style. Regards, João Paulo Figueira Embedded MVP

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

        No, I do insert the LVS_OWNERDATA style when creating the List Control. Here is the code: 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); } void CChildView::OnGetdispinfoList(NMHDR* pNMHDR, LRESULT* pResult) { LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR; // TODO: Add your control notification handler code here LV_ITEM* pItem= &(pDispInfo)->item; int iItemIndx = pItem->iItem; switch (g_nWorkingMode) { case 0: case 4: { CTimeRegItem *pListItem; pListItem = (CTimeRegItem*) m_arrayElements[iItemIndx]; if (pItem->mask & LVIF_TEXT) //valid text buffer? { switch (pItem->iSubItem) { case 0: //Fill in main text lstrcpy(pItem->pszText, pListItem->m_strID); break; case 1: //Fill in subitem 1 lstrcpy(pItem->pszText, pListItem->m_strDate); break; case 2: //Fill in subitem 2 lstrcpy(pItem->pszText, pListItem->m_strDescription); break; case 3: //Fill in subitem 3 lstrcpy(pItem->pszText, pListItem->m_strDuration); break; } } else if (pItem->mask & LVIF_IMAGE) { pItem->iImage = pListItem->m_nImage; } } break; case 1: { COtherListItem *pListItem; pListItem = (COtherListItem*) m_arrayElements[iItemIndx]; if (pItem->mask & LVIF_TEXT) //valid text buffer? { switch (pItem->iSubItem) { case 0: //Fill in main text lstrcpy(pItem->pszText, pListItem->m_strID); break; case 1: //Fill in subitem 1 lstrcpy(pItem->pszText, pListItem->m_strType); break; case 2: //Fill in subitem 2 lstrcpy(pItem->pszText, pListItem->m_strName); break; } } } break; case 2: case 3: { COtherListItem *pListItem; pListItem = (COtherListItem*) m_arrayElements[iItemIndx]; if (pItem->mask & LVIF_TEXT) //valid text buffer? { switch (pItem->iSubItem) { case 0: //Fill in main text lstrcpy(pItem->pszText, pListItem->m_strID); break; case 1: //Fill in subitem 1 lstrcpy(pItem->pszText, pListItem->m_strName); break; } } } break; } break; } *pRe

        J 1 Reply Last reply
        0
        • B Bui Huy Kien

          No, I do insert the LVS_OWNERDATA style when creating the List Control. Here is the code: 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); } void CChildView::OnGetdispinfoList(NMHDR* pNMHDR, LRESULT* pResult) { LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR; // TODO: Add your control notification handler code here LV_ITEM* pItem= &(pDispInfo)->item; int iItemIndx = pItem->iItem; switch (g_nWorkingMode) { case 0: case 4: { CTimeRegItem *pListItem; pListItem = (CTimeRegItem*) m_arrayElements[iItemIndx]; if (pItem->mask & LVIF_TEXT) //valid text buffer? { switch (pItem->iSubItem) { case 0: //Fill in main text lstrcpy(pItem->pszText, pListItem->m_strID); break; case 1: //Fill in subitem 1 lstrcpy(pItem->pszText, pListItem->m_strDate); break; case 2: //Fill in subitem 2 lstrcpy(pItem->pszText, pListItem->m_strDescription); break; case 3: //Fill in subitem 3 lstrcpy(pItem->pszText, pListItem->m_strDuration); break; } } else if (pItem->mask & LVIF_IMAGE) { pItem->iImage = pListItem->m_nImage; } } break; case 1: { COtherListItem *pListItem; pListItem = (COtherListItem*) m_arrayElements[iItemIndx]; if (pItem->mask & LVIF_TEXT) //valid text buffer? { switch (pItem->iSubItem) { case 0: //Fill in main text lstrcpy(pItem->pszText, pListItem->m_strID); break; case 1: //Fill in subitem 1 lstrcpy(pItem->pszText, pListItem->m_strType); break; case 2: //Fill in subitem 2 lstrcpy(pItem->pszText, pListItem->m_strName); break; } } } break; case 2: case 3: { COtherListItem *pListItem; pListItem = (COtherListItem*) m_arrayElements[iItemIndx]; if (pItem->mask & LVIF_TEXT) //valid text buffer? { switch (pItem->iSubItem) { case 0: //Fill in main text lstrcpy(pItem->pszText, pListItem->m_strID); break; case 1: //Fill in subitem 1 lstrcpy(pItem->pszText, pListItem->m_strName); break; } } } break; } break; } *pRe

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

          :doh: Sorry! I "shot from the hip" and didn't realise what the assert is all about. The code is asserting on CListCtrl::SetItemText. This method cannot work if you have the LVS_OWNERDATA style set. To change the data on a LVS_OWNERDATA list view, you must change the underlying data structure and invalidate the row. If you are adding new rows, you must reflect the new row (item) count. Regards, João Paulo Figueira Embedded MVP

          B 1 Reply Last reply
          0
          • J Joao Paulo Figueira

            :doh: Sorry! I "shot from the hip" and didn't realise what the assert is all about. The code is asserting on CListCtrl::SetItemText. This method cannot work if you have the LVS_OWNERDATA style set. To change the data on a LVS_OWNERDATA list view, you must change the underlying data structure and invalidate the row. If you are adding new rows, you must reflect the new row (item) count. Regards, João Paulo Figueira Embedded MVP

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

            Thank you so much. You are very kind. Finally, I found that I had called the SetItem function in my code. Best regards, -Kien Bui

            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