We help IT Professionals succeed at work.

Tree view making my Dialog box unresponsive

Medium Priority
475 Views
Last Modified: 2013-11-25
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
Comment
Watch Question

Commented:
Can you post some code about your tree view initialization?

Author

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);
CERTIFIED EXPERT

Commented:
Hi SumitKalsait,

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

ZOPPO

Commented:
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);

Author

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

Commented:
I think it should be

TreeView_Expand( m_Tree,   TSys , TVM_EXPAND);

Author

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
CERTIFIED EXPERT
Commented:
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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.