Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Stretch a control to the end of a toolbar
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Stretch a control to the end of a toolbar

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


Joined: 13 May 2003
Location: United States
Status: Offline
Points: 48
Post Options Post Options   Thanks (0) Thanks(0)   Quote spike Quote  Post ReplyReply Direct Link To This Post Topic: Stretch a control to the end of a toolbar
    Posted: 23 July 2004 at 9:46am

Does anyone know a way to stretch a control (edit) to the end of a toolbar its in?

 CXTPCommandBars* pCommandBars = GetCommandBars();

 CXTPToolBar* pCommandBar = (CXTPToolBar*)pCommandBars->Add(_T("Output Queue Toolbar"), xtpBarTop);

 if( pCommandBar )
 {
  pCommandBars->GetCommandBarsOptions()->bSh owExpandButtonAlways  = FALSE;

  CXTPControlEdit *pControl = (CXTPControlEdit *)pCommandBar->GetControls()->Add( xtpControlEdit, ID_OUTPUTFILTER_EDIT );

  pControl->SetCaption( "Filter:" );

  pCommandBar->SetFlags(xtpFlagStretched);

  pCommandBar->EnableDocking( xtpFlagStretched );
 } 

I just have the one edit control in the toolbar and would like it to take up the whole width of the toolbar and size when the toolbar is sized.

 

Thanks

Craig

 

Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 06 August 2004 at 9:13am
No one has responded to this post, so I'll see if I can help.

I haven't tried this, but I would use the GetWidth method for the CommandBar to determine the size.  Assuming that the edit control is the only control on the toolbar (from your post, it sounds like it is), then I would use the SetWidth method on the Edit control.
Back to Top
spike View Drop Down
Groupie
Groupie


Joined: 13 May 2003
Location: United States
Status: Offline
Points: 48
Post Options Post Options   Thanks (0) Thanks(0)   Quote spike Quote  Post ReplyReply Direct Link To This Post Posted: 06 December 2004 at 8:32am

CAn someone from codejock help here? This hasnt been answered and I still dont have a good solution for it.

 

Thanks

 

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: 06 December 2004 at 3:11pm

in next version we will add xtpFlagControlStretched flag.

You can patch your sources if you don't want wait next version:

1. add XTPControlFlags::xtpFlagControlStretched = 32 (XTPCommandBarDefines.h)

2. replace in XTPControls.cpp:

void CXTPControls::_MoveRightAlligned(XTPBUTTONINFO* pData, CSize sizeResult, CRect rcBorder, DWORD dwMode)
{

[attached]
}

 

3. Now you can use it:

 

CXTPControlComboBox* pComboMasked = (CXTPControlComboBox*)CControlComboBoxEx::CreateObject();
   pComboMasked->SetDropDownListStyle();
   
   pComboMasked->AddString(_T("12:00:20:30 "));
   pComboMasked->AddString(_T("11:03:12:30 "));
   pComboMasked->AddString(_T("00:00:12:30 "));
   pComboMasked->AddString(_T("10:00:30:30 "));
   
   pComboMasked->SetWidth(130);
   pComboMasked->SetCaption(_T("Masked"));
   pComboMasked->SetStyle(xtpComboLabel);
   pComboMasked->SetFlags(xtpFlagManualUpd ate|xtpFlagControlStretched);

   lpCreateControl->pControl = pComboMasked;



Edited by oleg
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
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: 06 December 2004 at 3:14pm
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
spike View Drop Down
Groupie
Groupie


Joined: 13 May 2003
Location: United States
Status: Offline
Points: 48
Post Options Post Options   Thanks (0) Thanks(0)   Quote spike Quote  Post ReplyReply Direct Link To This Post Posted: 06 December 2004 at 6:04pm
Thanks Oleg, I will give it a shot tomorrow.
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.188 seconds.