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. CTreeCtrl Speeding issue

CTreeCtrl Speeding issue

Scheduled Pinned Locked Moved C / C++ / MFC
helpdatabase
4 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.
  • V Offline
    V Offline
    Vikram Kashyap
    wrote on last edited by
    #1

    :rose: Hi Friends, I've a treectrl on a dialog based application which gets populated from ms-access database containing some 2000 records in OnInItDialog. To fetch the data, i am simply using the SQLFetch and inserting it using a while loop in treectrl using InsertItem, but it takes too much of time. Can anybody help me in speeding up my treectrl. The fields in my database are "BookmarkName", "BookmarkType" where Bookmark name is the bookmark name and BookmarkType is either "Folder" or "Bookmark" and Bookmarks are added as child in Folders. Vikram Kashyap "You will never fail, until u stop trying"

    B J 2 Replies Last reply
    0
    • V Vikram Kashyap

      :rose: Hi Friends, I've a treectrl on a dialog based application which gets populated from ms-access database containing some 2000 records in OnInItDialog. To fetch the data, i am simply using the SQLFetch and inserting it using a while loop in treectrl using InsertItem, but it takes too much of time. Can anybody help me in speeding up my treectrl. The fields in my database are "BookmarkName", "BookmarkType" where Bookmark name is the bookmark name and BookmarkType is either "Folder" or "Bookmark" and Bookmarks are added as child in Folders. Vikram Kashyap "You will never fail, until u stop trying"

      B Offline
      B Offline
      BlackDice
      wrote on last edited by
      #2

      you should probably post a snippet of what your routine to insert the items into your tree control looks like. That'll make it easier for us to see where you might have any problems Who are all these people and what are they doing in my house?...Me in 30 years, inside a grocery store My articles[^] bdiamond :zzz:

      V 1 Reply Last reply
      0
      • V Vikram Kashyap

        :rose: Hi Friends, I've a treectrl on a dialog based application which gets populated from ms-access database containing some 2000 records in OnInItDialog. To fetch the data, i am simply using the SQLFetch and inserting it using a while loop in treectrl using InsertItem, but it takes too much of time. Can anybody help me in speeding up my treectrl. The fields in my database are "BookmarkName", "BookmarkType" where Bookmark name is the bookmark name and BookmarkType is either "Folder" or "Bookmark" and Bookmarks are added as child in Folders. Vikram Kashyap "You will never fail, until u stop trying"

        J Offline
        J Offline
        Joel Lucsy
        wrote on last edited by
        #3

        Well, the database fetching data could be slow. Another could be the tree control. To get the tree to fill faster you can turn off the visual update of the control during the fill. Lookup SetRedraw or WM_SETREDRAW on MSDN or your help. -- Joel Lucsy

        1 Reply Last reply
        0
        • B BlackDice

          you should probably post a snippet of what your routine to insert the items into your tree control looks like. That'll make it easier for us to see where you might have any problems Who are all these people and what are they doing in my house?...Me in 30 years, inside a grocery store My articles[^] bdiamond :zzz:

          V Offline
          V Offline
          Vikram Kashyap
          wrote on last edited by
          #4

          Hi, the code snippet... void CInsertBookmark::LoadTreeItems() { BeginWaitCursor(); m_pTree.SetRedraw(FALSE); //Works fine in case of lesser records CString BookMarkType, BookMarkPath, BookMarkName; BookMarkType.Empty(); BookMarkPath.Empty(); BookMarkName.Empty(); CString TempPath; TempPath.Empty(); HSTMT hstmt; SDWORD len = SQL_NTS; RETCODE rc; char m_BookMark_Node_Path[256]; char m_BookMark_Node_Name[256]; char m_BookMark_Type[256]; int nIndex = 0; strTemp.Format("SELECT BookMark_Node_Path, " "BookMark_Node_Name, " "BookMark_Type " "FROM BookMark " "ORDER BY BookMark_Node_Path"); SQLAllocStmt(m_pdb->m_hdbc , &hstmt); SQLBindCol(hstmt,1, SQL_C_CHAR, &m_BookMark_Node_Path , sizeof(m_BookMark_Node_Path), &len); SQLBindCol(hstmt,2, SQL_C_CHAR, &m_BookMark_Node_Name , sizeof(m_BookMark_Node_Name), &len); SQLBindCol(hstmt,3, SQL_C_CHAR, &m_BookMark_Type , sizeof(m_BookMark_Type) , &len); if (SQLExecDirect(hstmt, (UCHAR*)(LPCTSTR)strTemp, SQL_NTS) == SQL_ERROR) { DisplayErrorMsg(&hstmt); SQLFreeStmt (hstmt, SQL_DROP); return ; } while(TRUE) { rc = SQLFetch(hstmt); if(rc == SQL_ERROR) { DisplayErrorMsg(&hstmt); SQLFreeStmt (hstmt, SQL_DROP); return ; } else if(rc == SQL_NO_DATA_FOUND) break; BookMarkPath.Empty(); BookMarkPath.Format("%s",m_BookMark_Node_Path); BookMarkType.Empty(); BookMarkType.Format("%s",m_BookMark_Type); BookMarkName.Empty(); BookMarkName.Format("%s",m_BookMark_Node_Name); if(BookMarkType.CompareNoCase("Folder") == 0) { m_pTree.Initialize(true); HTREEITEM hItem = m_pTree.GetNext(); while (hItem != NULL) { m_pTree.SelectItem(hItem); TempPath = GetPathFromItem(hItem) ; if(TempPath.Compare(BookMarkPath) == 0) { //Inserting items into tree ctrl m_pTree.InsertItem(_T(BookMarkName), ILI_CLSDFLD, ILI_OPENFLD, hItem, TVI_SORT); BookMarkPath.Empty(); BookMarkType.Empty(); break; } else hItem= m_pTree.GetNext(); } } if(BookMarkType.CompareNoCase("BookMark") == 0) { m_pTree.Initialize(true); HTREEITEM hItem= m_pTree.GetNext(); while (hItem != NULL) { m_pTree.SelectItem(hItem); TempPath = GetPathFromItem(hItem); if( TempPath.Compare(BookMarkPath) == 0) { //Inserting items into tree ctrl m_pTree.InsertItem(

          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