Click here to Skip to main content
16,016,712 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
"CToolTipCtrl m_clttcToolTip" declared on class level.
C++
BOOL CAdd::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	m_ILRadio.SetCheck(1);	
	m_clttcToolTip.Create(this);
	m_clttcToolTip.Activate(TRUE);
	m_clttcToolTip.SetTipBkColor(RGB(250,220,200));
	m_clttcToolTip.AddTool(&m_ILRadio,"Setting tooltip for radio1");
        m_clttcToolTip.AddTool(&m_ILRadio,"Setting tooltip for radio2");
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CAddDict::PreTranslateMessage(MSG* pMsg) 
{
	m_clttcToolTip.RelayEvent(pMsg);
	return CDialogSK::PreTranslateMessage(pMsg);
}

Problem:I need to show tooltip on individual radio button in radio button group.As only one control variable can be defined in group radio button in class wizard.
How to set tooltip for each radio button?
Posted
Updated 12-Jul-10 20:19pm
v2
Comments
Sandeep Mewara 13-Jul-10 2:19am    
Use PRE tags to format code part from next time. It makes the question readable.

1 solution

There are two ways as far as I can tell.

The first being adding member variables for each radio button. This is possible since they have different ID's.
m_clttcToolTip.AddTool(GetDlgItem(IDC_BT_1), "Setting tooltip for radio1");
m_clttcToolTip.AddTool(GetDlgItem(IDC_BT_2), "Setting tooltip for radio2");


or you could use their rectangles instead
CRect rc1;
GetDlgItem(IDC_BT_1)->GetWindowRect(&rc1);
ScreentToClient(rc1);
m_clttcToolTip.AddTool(this, "Setting tooltip for radio1", &rc1);
...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900