CTreeCtrl::GetCheck: why alway get the previous state? 
Author Message
 CTreeCtrl::GetCheck: why alway get the previous state?

I have an application, which displays different objects. I build those object
names to a tree(since some objects are children of others). Each item in my tree
ctrl has a check box, I check the item states in OnClick method to see if the
object should be on or off. All the objects are default set by display on, and
all the check boxes look right at the beginning (they all been checked).

Then if I click on one check box, the check mark is gone, which is right, but the
GetCheck returns TRUE, and I click on the same check box again, the check mark is
back, the GetCheck returns FALSE. Everytime the GetCheck returns the previous
state.

Anyone has ideas? DoI need to call SetCheck some where?

Thanks.



Mon, 27 Oct 2003 01:20:09 GMT  
 CTreeCtrl::GetCheck: why alway get the previous state?

Quote:
>Then if I click on one check box, the check mark is gone, which is right, but the
>GetCheck returns TRUE, and I click on the same check box again, the check mark is
>back, the GetCheck returns FALSE. Everytime the GetCheck returns the previous
>state.

Linda,

When/where are you calling GetCheck? Is it in the notification handler
of the check change event perhaps?

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
My address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow-up email copies.



Mon, 27 Oct 2003 20:40:01 GMT  
 CTreeCtrl::GetCheck: why alway get the previous state?
I figured it out. You are right, I called Getcheck too early, in OnClick method.

Thanks

Quote:
-----Original Message-----
>Then if I click on one check box, the check mark is gone, which is right, but
the
>GetCheck returns TRUE, and I click on the same check box again, the check mark
is
>back, the GetCheck returns FALSE. Everytime the GetCheck returns the previous
>state.

Linda,

When/where are you calling GetCheck? Is it in the notification handler
of the check change event perhaps?

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
My address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow-up email copies.
.



Wed, 29 Oct 2003 02:17:28 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. dropdown button in toolbar is always disabled state.

2. Tri-state checkbox in a ctreectrl

3. CTreeCtrl - How to put triple state checkboxes

4. CTreeCtrl - 3 state checkboxes

5. State Images in CTreeCtrl

6. indeterminate state in CTreeCtrl...

7. Updating the state image of CTreeCtrl item

8. Saving CTreeCtrl state

9. CTreeCtrl : How to register the expanding states of the whole tree

10. Set state to CTreeCtrl

11. why list view subitem images overlap previous column ?

12. CtreeCtrl-OnEndLabelEdit: item.pszText is always NULL

 

 
Powered by phpBB® Forum Software