Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 464
  • Last Modified:

Tree view making my Dialog box unresponsive

Hello
I have my tree view in the Dialog box, when dialog box get opened it shows some node to that me with this following function
TreeView_Expand( m_Tree,   DataSys, TVM_EXPAND);

but when i try to expand and unexpand manually in dialog box it make my whole application unresponsive.
Any suggestions
Many Thanks
0
SumitKalsait
Asked:
SumitKalsait
  • 3
  • 3
  • 2
1 Solution
 
alb66Commented:
Can you post some code about your tree view initialization?
0
 
SumitKalsaitAuthor Commented:
unsigned int tree_i;
            
            HTREEITEM TSys,TSlave;
            
            TreeView_DeleteAllItems(m_Tree);

            FiboSys = m_Tree.InsertItem("T-Master", TVI_ROOT);
                  
            for(int i=0; i<Member.count; i++)
            {
                  sprintf(temp_char_string, "T-Slave: %u", (i+1));
                  TSlave = m_Tree.InsertItem(temp_char_string,1,1, TSys);
            }
            TreeView_Expand( m_Tree,   TSys, TVM_EXPAND);
            UpdateData(FALSE);
0
 
ZoppoCommented:
Hi SumitKalsait,

what is 'FiboSys'? Shouldn't it be 'TSys'? Otherwise 'TSys' is uninitialized ...

ZOPPO
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
alb66Commented:
I think should be:

           HTREEITEM TSys,TSlave;
           
            TreeView_DeleteAllItems(m_Tree);

            FiboSys = m_Tree.InsertItem("T-Master", TVI_ROOT);
                 
            for(int i=0; i<Member.count; i++)
            {
                  sprintf(temp_char_string, "T-Slave: %u", (i+1));
                  TSlave = m_Tree.InsertItem(temp_char_string,1,1, FiboSys );
            }
            TreeView_Expand( m_Tree,   FiboSys , TVM_EXPAND);
            UpdateData(FALSE);
0
 
SumitKalsaitAuthor Commented:
HTREEITEM TSys,TSlave;
           
            TreeView_DeleteAllItems(m_Tree);

            TSys = m_Tree.InsertItem("T-Master", TVI_ROOT);
                 
            for(int i=0; i<Member.count; i++)
            {
                  sprintf(temp_char_string, "T-Slave: %u", (i+1));
                  TSlave = m_Tree.InsertItem(temp_char_string,1,1, TSys );
            }
            TreeView_Expand( m_Tree,   FiboSys , TVM_EXPAND);
            UpdateData(FALSE)


sorry for my mistake its like this

this put nodes in my tree but when with my mouse i click unexpand exapand several time it makes my application unresponsive
0
 
alb66Commented:
I think it should be

TreeView_Expand( m_Tree,   TSys , TVM_EXPAND);
0
 
SumitKalsaitAuthor Commented:
HTREEITEM TSys,TSlave;
           
            TreeView_DeleteAllItems(m_Tree);

            TSys = m_Tree.InsertItem("T-Master", TVI_ROOT);
                 
            for(int i=0; i<Member.count; i++)
            {
                  sprintf(temp_char_string, "T-Slave: %u", (i+1));
                  TSlave = m_Tree.InsertItem(temp_char_string,1,1, TSys );
            }
            TreeView_Expand( m_Tree,   TSys , TVM_EXPAND);
            UpdateData(FALSE)


Once again sorry for my mistake its like this

this put nodes in my tree but when with my mouse i click unexpand exapand several time it makes my application unresponsive

Thanks alb66
0
 
ZoppoCommented:
ok,  I guess the problem doesn't have to do with the posted code fragment - the filling of the tree seems to work correct.

In which way is the application getting 'unresponsive'?

Take a look at it's CPU usage in TaskManager - if it's 100% (or i.e. 50% on dual core) then the application most probably ran into an infinite loop. If so you can try to find the cause by starting the application in the debugger and in case it hangs use 'Debug->Break' and check the call-stack, maybe you can find the function which causes the loop.

If CPU usage is 0% it might be there's a deadlock if your application uses multi threading. Even in this case it should be possible to find out which functions/thread cause it with debugging and 'Debug->Break'

Of course maybe there are other reasons - hard to say without debugging it ...

ZOPPO
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now