wxCrafter generated code using variables (wxSpinCtrl)?
Posted: Fri Aug 28, 2015 7:10 pm
Dear experts,
I am trying to set up a wxSpinCtrl where the minimum, maximum and default values are set by variables (g_default, g_min, g_max, see the code snippet below. I currently have them in a file global.cpp, later they will be read from a configuration file). wxCrafter is accepting the variables, but in order to compile the generated code, I manually have to edit wxcrafter.cpp (which I am not supposed to do ) and insert a line pointing to the header file to be included ("#include global.h") to make it compile and work. Of course, after the next edit of the GUI, this will be gone.
For illustration, the code generated by wxCrafter looks like this:
In addition (as wxT("g_default") already might suggest), the default value is not taken from the variable g_default, but instead "1" is used.
Any suggestions how one could solve these problems, e.g. is there a way to make wxCrafter automatically include some lines of user code into generated code for the GUI? Or do I simply follow the wrong approach (being still pretty new to C++, wxWidgets, CodeLite and wxCrafter).
Many thanks for your help and suggestions!
I am trying to set up a wxSpinCtrl where the minimum, maximum and default values are set by variables (g_default, g_min, g_max, see the code snippet below. I currently have them in a file global.cpp, later they will be read from a configuration file). wxCrafter is accepting the variables, but in order to compile the generated code, I manually have to edit wxcrafter.cpp (which I am not supposed to do ) and insert a line pointing to the header file to be included ("#include global.h") to make it compile and work. Of course, after the next edit of the GUI, this will be gone.
For illustration, the code generated by wxCrafter looks like this:
Code: Select all
m_spinCtrl = new wxSpinCtrl(m_panel, wxID_ANY, wxT("g_default"), wxDefaultPosition, wxSize(-1,-1), wxSP_ARROW_KEYS);
m_spinCtrl->SetRange(g_min, g_max);
m_spinCtrl->SetValue(0);
Any suggestions how one could solve these problems, e.g. is there a way to make wxCrafter automatically include some lines of user code into generated code for the GUI? Or do I simply follow the wrong approach (being still pretty new to C++, wxWidgets, CodeLite and wxCrafter).
Many thanks for your help and suggestions!