Print Page | Close Window

CXTPControlComboBox

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=1217
Printed Date: 06 March 2025 at 4:10am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPControlComboBox
Posted By: andreaswill
Subject: CXTPControlComboBox
Date Posted: 29 September 2004 at 1:01pm

Hallo,

 

i have a problem with the CXTPControlComboBox. I inserted it into a CXTPToolbar. When disabling the control, no content is shown in the combobox.

m_ComboRight = (CXTPControlComboBox*CXTPControlComboBox::CreateObject();
m_ComboRight->AddString( "Block" );
m_ComboRight->AddString( "Text" );
m_ComboRight->AddString( "Attribute" );
m_ComboRight->SetCurSel(0);
m_ComboRight->SetEnabled(FALSE);

 

I want that 'block' is shown when the Combobox is in disabled state.What do i have to do ?

 

Thanks

Andreas

 




Replies:
Posted By: Oleg
Date Posted: 30 September 2004 at 12:15am

you need to add custom paint maanger:

 

class CCustomPaintManager : public CXTPOfficeTheme // CXTPOffice2003Theme
{
 CSize DrawControlComboBox(CDC* pDC, CXTPControlComboBox* pControlCombo, BOOL bDraw)
 {
  CSize sz = CXTPOfficeTheme::DrawControlComboBox(pDC, pControlCombo, bDraw);

  if (bDraw && !pControlCombo->GetEnabled() && !pControlCombo->GetEditCtrl())
  {
   CRect rc = pControlCombo->GetRect();
   int nThumb = pControlCombo->m_nThumbWidth;
   CRect rcBtn (rc.right - nThumb, rc.top, rc.right, rc.bottom);


   BOOL bPopupBar = pControlCombo->GetParent()->GetType() == xtpBarTypePopup;
   if (bPopupBar ||pControlCombo->GetStyle() == xtpComboLabel)
   {
    rc.left += pControlCombo->m_nLabelWidth;
   }

   CRect rcText(rc); rcText.DeflateRect(3, 1, rcBtn.Width(), 1);
   pDC->SetTextColor(GetXtremeColor(COLOR_ GRAYTEXT));
   pDC->DrawText(pControlCombo->GetText (), rcText, DT_SINGLELINE | DT_VCENTER);  
  }

  return sz;
 }

};

 

 

usage:

 XTPPaintManager()->SetCustomTheme(new CCustomPaintManager());



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



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