I have created a toolbar using a “CRhinoUiDockBar” and a “CRhinoUiDockBarDialog”.
Every thing is OK except that we would like to prevent the resizing of this toobar in Rhino.
This toolbar contain several edit box, some check box, it would be too complicated to deal with re-arrange the controls when the toolbar is resized… So we prefer prevent the resize and keep the toolbar horizontal and with a predefined size.
How is it possible to do that ?
CRhinoUiDockBar and CRhinoUiDockBarDialog doesn’t seems to have properties related to this subject…
This isn’t documented, but you can keep a CRhinoUiDockBar from resizing by setting the “min” and “max” sizes for floating, docked horizontal and docked vertical to the same CSize value:
You can also easily resize control’s using the CRhinoUiDialogItemResizer member of CRhinoUiDialog - CRhinoUiDialog::m_Resize. There are a number of SDK samples that demonstrate how to use this, including:
IMPLEMENT_SERIAL( CCaptureGUIEditingToolBar, CRhinoUiDockBar, 1)
// C C a p t u r e G U I E d i t i n g T o o l B a r
CCaptureGUIEditingToolBar::CCaptureGUIEditingToolBar( )
{
}
// ~C C a p t u r e G U I E d i t i n g T o o l B a r
CCaptureGUIEditingToolBar::~CCaptureGUIEditingToolBar( )
{
}
BEGIN_MESSAGE_MAP( CCaptureGUIEditingToolBar, CRhinoUiDockBar )
ON_WM_CREATE( )
END_MESSAGE_MAP( )
// D o c k B a r I D
UUID CCaptureGUIEditingToolBar::DockBarID( ) const
{
// {1FA452B3-5676-4E74-8333-10A50F2FA950}
static const GUID CCaptureGUIEditingToolBar_UUID =
{ 0x1fa452b3, 0x5676, 0x4e74, { 0x83, 0x33, 0x10, 0xa5, 0xf, 0x2f, 0xa9, 0x50 } };
return CCaptureGUIEditingToolBar_UUID;
}
// D o c k B a r N a m e
const wchar_t* CCaptureGUIEditingToolBar::DockBarName( int language_id ) const
{
switch( language_id ) {
case 1033 : return L"RhinoCapture : editing"; // EN
case 1036 : return L"RhinoCapture : editing"; // FR
}
return L"RhinoCapture : editing"; // default EN
}
// C r e a t e D o c k B a r C o n t r o l s
bool CCaptureGUIEditingToolBar::CreateDockBarControls( )
{
bool bCREATE = CreateDockBarClientDialog( CCaptureGUIEditingToolBarDialog::IDD, 0, RUNTIME_CLASS( CCaptureGUIEditingToolBarDialog ), AfxGetStaticModuleState( ) );
return bCREATE;
}
// O n C r e a t e
int CCaptureGUIEditingToolBar::OnCreate( LPCREATESTRUCT lpCreateStruct )
{
this->m_szMinFloat = m_szMinHorz = m_szMinVert = CSize( 518, 49 );
this->m_szMaxFloat = m_szMaxHorz = m_szMaxVert = CSize( 518, 49 );
if( CRhinoUiDockBar::OnCreate( lpCreateStruct ) == -1 ) return -1;
return 0;
}
But I have’nt found the best way to determine the « CSize » value (815 x 49 in this case).
In order to fin dit, I had to use « GetWinodwRect » once time and then to hard-code those values…
What’s the proper way to get the normal floatting size and then to give it to m_szMinFloat, M_szMinHorz and m_szMinVert ?
I put together a simple plug-in example that creates a control bar that floats by default and has a fixed size when floating. ControlBarWithFixedSize.zip (24.7 KB)
The control bar gets displayed by running the ControlBarWithFixedSize command.