Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - controlcombobox
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

controlcombobox

 Post Reply Post Reply
Author
Message
feffe View Drop Down
Groupie
Groupie


Joined: 04 September 2009
Status: Offline
Points: 56
Post Options Post Options   Thanks (0) Thanks(0)   Quote feffe Quote  Post ReplyReply Direct Link To This Post Topic: controlcombobox
    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 
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
feffe View Drop Down
Groupie
Groupie


Joined: 04 September 2009
Status: Offline
Points: 56
Post Options Post Options   Thanks (0) Thanks(0)   Quote feffe Quote  Post ReplyReply Direct Link To This Post Posted: 14 December 2009 at 8:02am
... You're right!
 
And... for setting a control position inside a group?
 
E.g., bottom/right
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
feffe View Drop Down
Groupie
Groupie


Joined: 04 September 2009
Status: Offline
Points: 56
Post Options Post Options   Thanks (0) Thanks(0)   Quote feffe Quote  Post ReplyReply Direct Link To This Post 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?
 
 
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
feffe View Drop Down
Groupie
Groupie


Joined: 04 September 2009
Status: Offline
Points: 56
Post Options Post Options   Thanks (0) Thanks(0)   Quote feffe Quote  Post ReplyReply Direct Link To This Post 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"?
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.109 seconds.