modifier un libellé dans un Cxtabctrl (ou CTabCTrl) : probléme
Bonjour,
Pour un projet, j'essaie de modifier le libellé d'un tab control.
Pour cela, j'ai rajouté une fonction dans le composant de Farscape
http://farscape.developpez.com/Samples/CxTabCtrl.zip
La fonction se base sur http://msdn.microsoft.com/en-us/library/dwzz1y47.aspx
la voici
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| void CXTabCtrl::SetTabText(int iIndex, LPCTSTR lpszCaption)
{
//http://msdn.microsoft.com/en-us/library/dwzz1y47.aspx
// Get the current tab item text.
TCITEM tcItem;
TCHAR buffer[256] = {0};
tcItem.pszText = buffer;
tcItem.cchTextMax = 256;
tcItem.mask = TCIF_TEXT|TCIF_PARAM;
this->GetItem(iIndex, &tcItem);
// Set the new text for the item.
tcItem.pszText = (LPTSTR) lpszCaption;
// Set the item in the tab control.
this->SetItem(iIndex, &tcItem);
} |
J'appel la fonction dans un timer
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| void CTabctrlDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
CTplDlgColor<CDialog>::OnTimer(nIDEvent);
CTime curTime = CTime::GetCurrentTime();
CString m_time;
m_time.Format("%02d:%02d:%02d",
curTime.GetHour(),
curTime.GetMinute(),
curTime.GetSecond());
m_tabctrl.SetTabText(0,(LPCTSTR)m_time);
} |
le problème , c'est qu'après appel de la fonction , le texte est bien changé mais le dialog incrusté dans le tab disparait.
Voila mon projet sous forme zippé
http://cxtabctrl.site.voila.fr/Cxtabctrl.zip
Merci d'avance pour vos réponses
PS : j'ai aussi tenté avec
Code:
tcItem.mask = TCIF_TEXT;
çà ne marche pas