CRhinoUiDockBar first show


#1

Hi,

After having created a CRhinoUiDockBar during OnLoadPlugIn( ), I would be sure that this dock bar is visible if this is the fist time than the plugin start.

After the first use, everything is ok because Rhino Load/Save the dock bars states… without anything to do.

But, just for THE FIRST load, how ensure to show a toolbar ?


(Dale Fugier) #2

Does this help?

– Dale


#3

Absolutly not !

Let’s me explain another time.

I have created a CRhinoUiDockBar, associated to CRhinoUiDockBarDialog…

I create it inside the ‘OnLoad’ of my pluggin like that :

CRhinoUiDockBar* pAccrObjTB = RhinoUiDockBarManager( ).CreateRhinoDockBar( RUNTIME_CLASS( CCaptureGUIAccrObjToolBar ), PlugInID( ), false, AFX_IDW_DOCKBAR_FLOAT, CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM, NULL, CBRS_SIZE_FIXED );

I want be sure that when the user start the pluggin FOR THE FIRST TIME, just after having installed it, than this toolbar was shown, visible, floatting.

At this time I have created a command than the user must run in order to show this toolbar :
RhinoUiDockBarManager( ).ShowDockBar( CCaptureGUIAccrObjToolBar( ).DockBarID( ), true, false ) == false )

But I would prefer to show it by default for the first time, and then it would be not necessary to run this command.

After this first time, I don’t mind… Everything is OK : Rhino SAVE et RESTORE toolbar state very well.

How to be sure to show by default the toolbar when the pluggin is started for the FIRST time…

That’s the question !
Is there some registry entry to look for ?


(Dale Fugier) #4

OK, I guess when you say “toolbar” you really mean “dockbar”…

You might try saving a flag that indicates whether or not your toolbar has ever been shown. Then check the flag when your plug-in loads. For example:

void CSampleDockbarPlugIn::LoadProfile(LPCTSTR lpszSection, CRhinoProfileContext& pc)
{
  pc.LoadProfileBool(lpszSection, L"LoadedOnce", &m_loaded_once);
}

void CSampleDockbarPlugIn::SaveProfile(LPCTSTR lpszSection, CRhinoProfileContext& pc)
{
  pc.SaveProfileBool(lpszSection, L"LoadedOnce", m_loaded_once);
}

BOOL CSampleDockbarPlugIn::OnLoadPlugIn()
{
  // Ask Rhino's DockBarManager to create our dockbar
  CRhinoUiDockBar* pDockbar = RhinoUiDockBarManager().CreateRhinoDockBar(
        RUNTIME_CLASS(CSampleRhinoDockbar), 
        PlugInID(), 
        false, 
        AFX_IDW_DOCKBAR_FLOAT,
        CBRS_ALIGN_ANY,
        NULL,
        CBRS_TOOLTIPS | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_LEFT
        );

  if (!m_loaded_once)
  {
    RhinoUiDockBarManager().ShowDockBar(CSampleRhinoDockbar().DockBarID(), true, false);
    m_loaded_once = true;
  }

  return TRUE;
}

#5

Nice Dale !
I have done it like you suggest it, and that’s ok.
Thank you.

Regards,

Fred