Print Page | Close Window

CXTPControlColorSelector

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=418
Printed Date: 23 December 2024 at 7:27am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPControlColorSelector
Posted By: JoeH
Subject: CXTPControlColorSelector
Date Posted: 05 February 2004 at 8:57am

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);
 }
 
}




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net