Print Page | Close Window

controlcombobox

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=15843
Printed Date: 01 May 2025 at 12:59am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: controlcombobox
Posted By: feffe
Subject: controlcombobox
Date Posted: 14 December 2009 at 5:18am
Hi,
 
I have a combo shown in a ribbon group.
I'd like the combo to be below icon and caption, not on the right of as you can see here.
 
Any suggestion?
 
Thank you very much 



Replies:
Posted By: Oleg
Date Posted: 14 December 2009 at 6:22am
Hi,
 
You can make 2 separate controls - xtpControlLabel with icon and caption + Combo without Icon and caption.


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


Posted By: feffe
Date Posted: 14 December 2009 at 8:02am
... You're right!
 
And... for setting a control position inside a group?
 
E.g., bottom/right


Posted By: Oleg
Date Posted: 15 December 2009 at 4:52am
Hi,
 
There is no such method :( If you don't like how Group position it with//without SetControlsCentering option you can override CXTPRibbonGroup::OnCalcDynamicSize and manually position them.


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


Posted By: feffe
Date Posted: 16 December 2009 at 12:20pm

Hi,

I've tried to override the method you've suggest.

For fastly seeing the result, I've tried to do this:


int CMyRibbonGroup::OnCalcDynamicSize(CDC* pDC))
{
   if(m_bReduced)
       return CXTPRibbonGroup::OnCalcDynamicSize(pDC);
 
   int nResultHeight = GetRibbonBar()->CalcGroupsHeight() - 8 - GetRibbonBar()->GetRibbonPaintManager()->GetGroupCaptionHeight();
   CXTPControl *pControl = GetAt(0);
   CSize szControl = pControl->GetSize(pDC);
   int dx = szControl.cx;
   int dy = szControl.cy;
   pControl->SetRect(CRect(x,0,x+dx,dy));
 
   return _bignumber;
}
 
I can't see anything in my group.
 
Is it correct to call CXTPControl::SetRect?
 
EDIT: The first time the group is shown I can't see anything...
If I minimize and then maximize the ribbon, I can see them...
And then if I switch tabs, they "go down" until they are not visible yet.
Why?
 
 


Posted By: Oleg
Date Posted: 17 December 2009 at 7:34am
Hi,
 
Sorry, CONTROLINFO is declared as private type of CXTPRibbnoGroup and seems you can't access it to position controls. Sorry our bad - we will move it to protected section (please also patch your sources) - you will be able to change m_pLayoutInfo array. See how original method works:
 
 
 
 
int nDataCount = m_pLayoutInfo->nControlCount;
 CONTROLINFO* pData = m_pLayoutInfo->pControls;
 for (int i = 0; i < nDataCount; i++)
 {
  CONTROLINFO* pControl = &pData;
  BOOL bFullRow = pControl->pControl->GetStyle() == xtpButtonIconAndCaptionBelow;
  pControl->EnsureButtonSize(pDC);
  CSize szControl = pControl->szControl;
  int dx = szControl.cx;
  int dy = szControl.cy;
  BOOL bBeginGroup = pControl->bBeginGroup && i > 0;
  BOOL bWrapGroup = pControl->bWrapGroup && i > 0;
  if (bBeginGroup)
   x += 6;
  if (i > 0 && !bWrapGroup && !bFullRow && dyPrev + dy <= nResultHeight)
  {
   pControl->rcControl.SetRect(x, dyPrev, x + dx, dyPrev + dy);
   dxPrev = max(dxPrev, dx);
  }
  else
  {
   x += dxPrev;
   pControl->rcControl.SetRect(x, 0, x + dx, dy);
   dxPrev = dx;
  }
  sizeResult.cx = max(x + dx, sizeResult.cx);
  dyPrev = pControl->rcControl.bottom;
 }


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


Posted By: feffe
Date Posted: 17 December 2009 at 8:49am

It works now.

Thank you!
 
Is there also a method for setting the position of icon and caption, when the style is
"icon and caption below"?



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