Hi all,
I seem to have a problem with an CXTPControlColorSelector in a VC6 legacy app. Searching the forums did not help, so here goes:
The control displays just fine, selection of colors for the text works just fine but the control's GUI never displays the selected text color.
The sample apps (e.g. TearOffPopups_vc60.dsw) do just that. The colored "bar" under the letter A on the control's GUI changes according to the selected text color.
BTW, I use a 3rd party control for the view (Text Control) but like I said: setting the color in the view is OK as is setting/updating the color in the CXTPControlButtonColor tear off "More colors..." (always shows the color of the text with the caret in it).
What am I missing?
Thanks,
Joe
Sample code:
Mainframe:
...
ON_UPDATE_COMMAND_UI(ID_COLORPICKER, OnUpdateSelectorTextColor)
...
OnCreateControl
...
if (lpCreateControl->nID == ID_COLORPICKER && pToolBar->GetBarID() == IDR_FORMATBAR)
{
[...]
CXTPControlPopupColor* pPopupColor = new CXTPControlPopupColor();
CXTPPopupBar* pColorBar = (CXTPPopupBar*)CXTPPopupToolBar::CreateObject();
pPopupColor->SetCommandBar(pColorBar);
pColorBar->GetControls()->Add(new CXTPControlColorSelector(), ID_COLORPICKER);
pColorBar->GetControls()->Add(new CXTPControlButtonColor(), ID_COLORPICKER_MORE);
pColorBar->EnableCustomization(FALSE);
pPopupColor->SetCaption(_T(strControlTitle));
pColorBar->SetTearOffPopup(_T(strControlTitle), ID_COLORPICKER, 0);
pColorBar->InternalRelease();
lpCreateControl->pControl = pPopupColor;
return TRUE;
}
UPDATE_COMMAND_UI Handler:
OnUpdateSelectorTextColor(CCmdUI* pCmd)
{
pCmd->Enable(TRUE);
CXTPCommandBar* pToolBar = (CXTPToolBar*)pCmd->m_pOther;
if (pToolBar)
{
CXTPControlColorSelector* pSelector = (CXTPControlColorSelector*)pToolBar->GetControls()->Ge tAt(pCmd->m_nIndex);
pSelector->SetColor(m_clrText);
}
}