lundi 30 janvier 2017

MFC Rich Edit Control 2.0 receiving click event

I was hoping someone out there would help me with my predicament I ran into. Essentially I have a Checkbox and a RichEditControl next to each other. I want to be able to know when a user has clicked on my RichEditControl so i can send a message to my checkbox to flag it on and off.

At first i tried to overlay my checkbox with empty text to act as a "blank" background for my RichEditControl so i wouldn't have to worry about sending messages left and right. No matter what i tried the "blank" background would overlap the RichEditControl text and leave it completely blank.

I searched on here for some help and i found this which is exactly what I ran into. I understand what he is saying but don't have the knowledge to implement what they said.

Right now I'm playing around with EN_LINK to attempt to capture a message so i can tell my checkbox to flag itself.

BEGIN_MESSAGE_MAP(TempInit, CDialog)
ON_NOTIFY(EN_LINK, IDC_TempInitMsg, &TempInit::OnEnLinkTempinitmsg)
END_MESSAGE_MAP()

void TempInit::OnEnLinkTempinitmsg(NMHDR *pNMHDR, LRESULT *pResult)
{
ENLINK *pEnLink = reinterpret_cast<ENLINK *>(pNMHDR);
// TODO: Add your control notification handler code here
    // TODO: Add your control notification handler code here
    radioClicked = !radioClicked;
    if (radioClicked == true)
    {
        GetParent()->SendMessage(WM_MYRADIOCLICKED, CHECKENABLED, 0);
    }
    else
    {
        GetParent()->SendMessage(WM_MYRADIOCLICKED, CHECKDISABLED, 0);
    }
}
*pResult = 0;
}

I'm sorry in advance if this is totally the wrong way to go about this. I've been googling for a few hours and have come empty handed. If anyone has any other method please help me if possible. I can post more code if what i have above isn't enough.




Aucun commentaire:

Enregistrer un commentaire