Monday, December 30, 2013

Codeblocks wxwidgets 3.0 project templates

Hello.
You can now use the new codeblocks version 13.12(that i didn't know came out at the date of writing this little tutorial). For those that for some unknown reason still want to use the old version(12.11) you can use this tutorial to be able to make wxWidgets 3.0 projects. In this little tutorial i will show you how to change the default wxwidgets template from codeblocks to be able to create wxwidgets 3.0 projects and use the 3.0 version of the library.

First open Codeblocks and chose to create a new project.
Then right click on the wxwidgets template and pick edit this script, like in the image below.
Edit wxWidgets script template
Edit wxWidgets Script


Next a new window will open in your Codeblocks editor named wizard.script like in the image below.
wxWidgets script template editor
wxWidgets script template editor


Next you will have to find and edit a few lines of code like so:

local intro_msg = _T("Welcome to the new wxWidgets 2.6.x / 2.8.x /2.9.x(SVN)\nproject wizard!\n\n" +
and you can replace it with something like this
local intro_msg = _T("Welcome to the new wxWidgets 2.6.x / 2.8.x /3.0\nproject wizard!\n\n" +
This just replaces the intro message.

Next is this:
Wizard.AddGenericSingleChoiceListPage(_T("wxVersionPage"), _T("Please select the wxWidgets version you want to use."), _T("wxWidgets 2.6.x;wxWidgets 2.8.x; wxWidgets 2.9.x (SVN Version)"), WxVersion);
and replace it with this:
Wizard.AddGenericSingleChoiceListPage(_T("wxVersionPage"), _T("Please select the wxWidgets version you want to use."), _T("wxWidgets 2.6.x;wxWidgets 2.8.x; wxWidgets 3.0"), WxVersion);
This will change the main window where you can chose what type of wxwidgets project you wish to create.

Next is this:
local intro_msg = _T("Welcome to the new wxWidgets 2.6.x / 2.8.x /2.9.x(SVN)\nTarget wizard!\n\n" +
with this:
local intro_msg = _T("Welcome to the new wxWidgets 2.6.x / 2.8.x /3.0\nTarget wizard!\n\n" +
and this:
Wizard.AddGenericSingleChoiceListPage(_T("wxVersionPage"), _T("Please select the wxWidgets version you want to use."), _T("wxWidgets 2.6.x;wxWidgets 2.8.x; wxWidgets 2.9.x (SVN Version)"), WxVersion); // select wxwidgets version
with this:
Wizard.AddGenericSingleChoiceListPage(_T("wxVersionPage"), _T("Please select the wxWidgets version you want to use."), _T("wxWidgets 2.6.x;wxWidgets 2.8.x; wxWidgets 3.0"), WxVersion); // select wxwidgets version
Next you need to find this line:
lib_wxver = _T("29"); 
and change it to this:
lib_wxver = _T("30");
This will hold the sufix for the library versions.

And that is pretty much it.
Now, just hit ctrl+s to save the modifications done to the file and close it.
You can now try and create your project with wxWidgets 3.0 now. the template should look something like this(red) now.
Edited project template
Edited project template



The red color indicates that the template has been modified.
When you select the project, the new windows should look something like this:
Edited wxWidgets version selector
Edited wxWidgets version selector


Home you find the tutorial helpful. See you at our next tutorial.