Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC
  New Posts New Posts RSS Feed - CXTCheckListBox is not checking the items
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Forum LockedCXTCheckListBox is not checking the items

 Post Reply Post Reply
Author
Message
devam View Drop Down
Groupie
Groupie
Avatar

Joined: 20 March 2008
Location: India
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote devam Quote  Post ReplyReply Direct Link To This Post Topic: CXTCheckListBox is not checking the items
    Posted: 14 April 2008 at 7:26am
Hi,
 
I have created a listbox in the resource statically and set its OwnerDraw property as fixed and have checked the Has Strings property.
In the header file I have changed the CListBox variable into a CXTCheckListBox variable.
In OnInitDialog I have initialized the checklistbox member variable by calling on the API     m_RoutedTrailsList.Initialize();
Now, when i have to dynamically add some items into the checklistbox and check or uncheck them based on certain conditions. I run a for () loop within which i check or uncheck the item by calling
                m_UnroutedTrailsList.SetCheck(iCount, 1); or
                m_UnroutedTrailsList.SetCheck(iCount, 0);
where my iCount denotes the index of the items and it begins from 0.
But I do not get the behaviour as expected, the code executes as expected and calls on m_UnroutedTrailsList.SetCheck(iCount, 1); for 4 times, each time incrementing iCount as expected.
But it checks only 3 items, the first item remains unchecked.
Can anyone give me a solution to this problem? Has anyone faced a similar problem before?
An immediate response is eagerly awaited.
Thanks,
Devam.

DC
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 14 April 2008 at 9:14am
Hi,
Show full code.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
devam View Drop Down
Groupie
Groupie
Avatar

Joined: 20 March 2008
Location: India
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote devam Quote  Post ReplyReply Direct Link To This Post Posted: 14 April 2008 at 9:46am
I cannot oleg. The company has its Information Security policies which prohibit me from uploading code at a public forum.
Anyways, I think its some issue with the index that I am using for setcheck()
Is there any issue with setcheck() like in case of CTreeCtrl where the style has to be set at the runtime only? Here do I need to call on a ModifyStyle () or some other API?
 
DC
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 14 April 2008 at 10:39am
Hi,
 
It have to work... Try to modify our sample then and reproduce problem.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
devam View Drop Down
Groupie
Groupie
Avatar

Joined: 20 March 2008
Location: India
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote devam Quote  Post ReplyReply Direct Link To This Post Posted: 15 April 2008 at 1:06am

Thanks for the help oleg. It worked!

I simply took the index which was returned after I called AddString(), and then used the same index to perform a SetCheck().

Lesson learnt: Never use a loop counter or any other variable as index while doing a SetCheck(). Always take the return value from the AddString API and then use the same return value to perform a SetCheck().

DC
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 15 April 2008 at 1:16am
ok :)
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.