CXTCheckListBox is not checking the items |
Post Reply |
Author | |
devam
Groupie Joined: 20 March 2008 Location: India Status: Offline Points: 15 |
Post Options
Thanks(0)
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
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Show full code.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
devam
Groupie Joined: 20 March 2008 Location: India Status: Offline Points: 15 |
Post Options
Thanks(0)
|
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
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
It have to work... Try to modify our sample then and reproduce problem.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
devam
Groupie Joined: 20 March 2008 Location: India Status: Offline Points: 15 |
Post Options
Thanks(0)
|
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
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
ok :)
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |