Here is an example of what I am trying to achieve:
If the user types "BallFollower" as the title of the project in the ProjectPathPage, I would like to append ".machine" to it. Our build process requires the .machine extension to be present in the name of the folder that contains all the sources. This identifies the codebase to be a Logic Labelled Finite State Machine. The actual cbp filename is not important as it is .gitignored anyway.
In order to make things easy to follow, I would like the title in the workspace and the project folder and cbp project names to be consistent, however, the folder name is the most important to get right.
I'm using a custom Wizard to massage the project's targets and set custom make commands to suit our needs. That part is working fine :). Since my original post, I have resorted to using a ShowMessage in the OnLeave_ProjectPathPage(fwd) event handler to alert the user that they need to enter the extension, and return false until they do so.
However, I would like to automate this. So, the problem that I'm facing is that the user's input on the ProjectPathPage cannot be edited in the OnLeave_ProjectPathPage(fwd) event handler because the page does not expose any setters for it's variables.
I tried using:
local machineName= Wizard.GetProjectName();
if (machineName.Find(_T(".machine")) < 1) {
GetProjectManager().GetActiveProject().SetTitle(machineName + _T(".machine"));
}
In the OnLeave_ProjectPathPage(fwd) event handler, to set the title but that does not set the same variable which is later used by the Wizard to create the project folder and cbp project file. In fact, the above code cannot be used in the OnLeave_ProjectPathPage(fwd) event handler because it renames the wrong project if there are existing projects in the workspace, one of which will, naturally, be already active.
Delaying the above code to the start of the SetupProject(project) function allows me to change the title, but not the names of the folder and CB project. So, only one out of three requirements achieved.
Is there a way of setting the Wizard's internal variables (like m_Wizards[index].title)? (I've looked at wiz.cpp and it does not appear to be possible.)
[I have attached my wizard.script file, with a .txt extension to pass the forum's filter.]
@BlueHazzard : The 'concept' you suggested in response to my other question (http://forums.codeblocks.org/index.php/topic,22023.msg149942.html#msg149942) has solved the problem I was facing.
I can now append .machine automatically using:
local machineName= Wizard.GetProjectName();
if (machineName.Find(_T(".machine")) < 1) {
ShowMessage(_T("The '.machine' extension will be automatically added to the title of the project."));
Wizard.SetTextControlValue(_T("ID_TEXTCTRL3"), machineName + _T(".machine"))
}
In the OnLeave_ProjectPathPage(fwd) event handler.
Thank you for looking into this for me!
Cheers,
Nap