Author Topic: empty target name when creating a project with assistant  (Read 3578 times)

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
empty target name when creating a project with assistant
« 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).

CB-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: empty target name when creating a project with assistant
« Reply #1 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));



Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
Re: empty target name when creating a project with assistant
« Reply #2 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.
CB-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl