Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: LETARTARE on December 18, 2017, 04:58:52 pm

Title: empty target name when creating a project with assistant
Post by: LETARTARE on December 18, 2017, 04:58:52 pm
When activating a project by hand a 'cbEVT_PROJECT_ACTIVATE' is generated, which is notified to the plugins.
If a plugin is sensitive to this event, then it can analyze the project and it active target.
In the case of the creation of a project by the assistant, the created project is also actived : but the name of the active target is empty ( the one recovered since the event ) !
I did not find the source of the problem.

I enclose a small generic plugin that captures this event and displays in the 'Code::Blocks' pane the result.

This plugin was created with : VISTA with cb-11246 (sdk=1.33.0), wx2.8.12, TDM-GCC 4.7.1 32 bits (unicode).

Title: Re: empty target name when creating a project with assistant
Post by: Pecan on December 18, 2017, 08:28:44 pm
After the Project_Activate event, another will occur for a new project.
It will have the target.

Manager::Get()->RegisterEventSink(cbEVT_PROJECT_NEW, new cbEventFunctor<genericplugin, CodeBlocksEvent>(this, &genericplugin::OnNewProject));


Title: Re: empty target name when creating a project with assistant
Post by: LETARTARE on December 19, 2017, 01:47:33 am
Hello @Pecan,
thank you for this constructive response. I would never have found it alone !
Indeed, it is a curious way to proceed: send the event 'Activated' before the event 'Created'.
But there are surely more obscure reasons ...

Thanks again.