Click here to Skip to main content
16,014,636 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: PPERF_DATA_BLOCK Question Pin
HES082717-Aug-10 15:13
HES082717-Aug-10 15:13 
Questionhow to change the background color of a checkbox in a list control? Pin
tataxin21-May-08 14:48
tataxin21-May-08 14:48 
AnswerRe: how to change the background color of a checkbox in a list control? Pin
Hamid_RT21-May-08 18:02
Hamid_RT21-May-08 18:02 
GeneralRe: how to change the background color of a checkbox in a list control? Pin
tataxin21-May-08 20:32
tataxin21-May-08 20:32 
GeneralRe: how to change the background color of a checkbox in a list control? Pin
tataxin22-May-08 3:12
tataxin22-May-08 3:12 
GeneralRe: how to change the background color of a checkbox in a list control? Pin
Hamid_RT22-May-08 22:48
Hamid_RT22-May-08 22:48 
GeneralRe: how to change the background color of a checkbox in a list control? Pin
tataxin23-May-08 2:40
tataxin23-May-08 2:40 
AnswerRe: how to change the background color of a checkbox in a list control? Pin
tataxin26-May-08 19:32
tataxin26-May-08 19:32 
I did it, not very well but it works.
Actually, I try to do similarly to XListCtrl
All I did here:

I have a class MyListCtr direved from CListCtrl. Then I override OnNMCustomdraw, try to draw the rectangualar with specificed color (black in my case).

The problem is how to catch event mouse click, determine checkbox state and change the drawing. I cannot understand the way XListCtrl do, it seems to register a defined event WM_XLISTCTRL_CHECKBOX_CLICKED, but I'm not sure. And TRACE, what is TRACE macro? hehe

So I did like this: use event NM_CLICK

void CMyDlg::OnNMClickListData(NMHDR *pNMHDR, LRESULT *pResult)
{
	/* get check box state */
	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
	*pResult = 0;

	if (pNMListView->uOldState == 0 && pNMListView->uNewState == 0)
		return;	// No change

	BOOL bPrevState = (BOOL)(((pNMListView->uOldState &
				LVIS_STATEIMAGEMASK)>>12)-1);   // Old check box state
	if (bPrevState < 0)	// On startup there's no previous state 
		bPrevState = 0; // so assign as false (unchecked)

	// New check box state
	BOOL bChecked=(BOOL)(((pNMListView->uNewState & LVIS_STATEIMAGEMASK)>>12)-1);
	if (bChecked < 0) // On non-checkbox notifications assume false
		bChecked = 0;

	if (bPrevState == bChecked) // No change in check box
		return;	
}


I'd tried some ways but not success until this. Actually, I found it somewhere else.
QuestionDumb Question Pin
bs197721-May-08 14:21
bs197721-May-08 14:21 
QuestionPut array of characters into an array member of a class Pin
Samjiman21-May-08 12:35
Samjiman21-May-08 12:35 
AnswerRe: Put array of characters into an array member of a class Pin
David Crow21-May-08 16:00
David Crow21-May-08 16:00 
GeneralRe: Put array of characters into an array member of a class Pin
Samjiman21-May-08 23:39
Samjiman21-May-08 23:39 
AnswerRe: Put array of characters into an array member of a class Pin
Rajkumar R22-May-08 0:12
Rajkumar R22-May-08 0:12 
GeneralRe: Put array of characters into an array member of a class Pin
Samjiman22-May-08 0:40
Samjiman22-May-08 0:40 
GeneralRe: Put array of characters into an array member of a class Pin
Rajkumar R22-May-08 0:56
Rajkumar R22-May-08 0:56 
GeneralRe: Put array of characters into an array member of a class Pin
Samjiman22-May-08 5:35
Samjiman22-May-08 5:35 
GeneralRe: Put array of characters into an array member of a class Pin
Samjiman22-May-08 0:13
Samjiman22-May-08 0:13 
QuestionFind control on dialog Pin
Giorgi Dalakishvili21-May-08 10:50
mentorGiorgi Dalakishvili21-May-08 10:50 
QuestionRe: Find control on dialog Pin
David Crow21-May-08 11:06
David Crow21-May-08 11:06 
AnswerRe: Find control on dialog Pin
Giorgi Dalakishvili21-May-08 11:18
mentorGiorgi Dalakishvili21-May-08 11:18 
AnswerRe: Find control on dialog Pin
Force Code21-May-08 11:21
Force Code21-May-08 11:21 
GeneralRe: Find control on dialog Pin
Giorgi Dalakishvili21-May-08 11:25
mentorGiorgi Dalakishvili21-May-08 11:25 
GeneralRe: Find control on dialog Pin
Force Code21-May-08 11:37
Force Code21-May-08 11:37 
GeneralRe: Find control on dialog Pin
Giorgi Dalakishvili21-May-08 11:50
mentorGiorgi Dalakishvili21-May-08 11:50 
GeneralRe: Find control on dialog Pin
Force Code21-May-08 12:14
Force Code21-May-08 12:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.