Print Page | Close Window

Stretch a control to the end of a toolbar

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=972
Printed Date: 19 November 2024 at 9:04am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Stretch a control to the end of a toolbar
Posted By: spike
Subject: Stretch a control to the end of a toolbar
Date 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

 




Replies:
Posted By: SuperMario
Date 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.


Posted By: spike
Date 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

 



Posted By: Oleg
Date 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;



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


Posted By: Oleg
Date Posted: 06 December 2004 at 3:14pm
https://forum.codejock.com/uploads/oleg/2004-12-06_151443_mra.zip - 2004-12-06_151443_mra.zip

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


Posted By: spike
Date Posted: 06 December 2004 at 6:04pm
Thanks Oleg, I will give it a shot tomorrow.



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