CommandBarButtonEvents

hi

 

i created a little addin in c++ (using your AddinWizard). This addin creates a additional

toolbar using

CommandBards->Add()

 

This works perfectly. Now i have the problem that i would need to add code to catch the event i tried to write the handler but it didn't work.

could you please help me ?

 

with nice greetings

Heinz

 

 

 

Posted by: Heinz Rath
Post date: 2/13/2007 6:15:57 AM

3 REPLIES

RE: CommandBarButtonEvents

Heinz,

 

See CEventManager::XAddInEvents::raw_OnCommand() in your example. This is where you catch the command events.

 

 

 

#ifdef SE_ADDIN_EVENTS

HRESULT CEventManager::XAddInEvents::raw_OnCommand( long nCmdID )

{

HRESULT hr = S_OK;

 

#ifdef SE_ADDIN_EXAMPLES

CLocateCommandObj* pLocateCommand = NULL;

 

switch (nCmdID)

{

case 0:

MessageBox((HWND)LongToHandle(m_pEventManager->m_pApplication->hWnd), _T("Pick a point on the model."), _T("Locate Demo"), MB_OK);

IfFailGoCheck(CLocateCommandObj::CreateInstance(&pLocateCommand), pLocateCommand);

pLocateCommand->AddRef();

pLocateCommand->CreateCommand( SolidEdgeConstants::seNoDeactivate );

pLocateCommand->GetCommand()->Start();

break;

case 1:

MessageBox((HWND)LongToHandle(m_pEventManager->m_pApplication->hWnd), _T("Command 2"), _T("Information"), MB_OK);

break;

}

Error:

 

#endif

 

return hr;

}

 

 

Posted by: Jason Newell
Post date: 2/13/2007 7:20:17 AM

RE: CommandBarButtonEvents

hi

 

sorry for my bad english.

thanks i have alread found this method. my problem is i have change the code inside the onCommand method to create a second toolbar. in a way like this (it is not the acutal code only a little part)

 

_bstr_t env=m_pApplication->GetActiveEnvironment();

EnvironmentPtr pEnv;

pEnv=pEnvs->Item (m_pApplication->GetEnvironments());

CommandBarPtr cmds=pEnv->GetCommandBars()->Add("Tool",seBarFloating);

 

the second toolbar shows correctly.

my problem now is if i add a button to this second toolbar i need to handle this events

extra.

Every button of this new bar sends a CommandBarButtonEvent i already tried to add code to

handle this eventy but it didn't work..

 

with nice greetings

heinz

 

 

Posted by: Heinz Rath
Post date: 2/13/2007 4:37:08 PM

RE: CommandBarButtonEvents

Heinz,

 

I don't have an immediate answer for you on this one. I'd have to try and code it. I can tell you that Solid Edge command bars are a real pain to work with. I'll let you know if I come up with anything.

 

Posted by: Jason Newell
Post date: 2/14/2007 5:27:26 AM