News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Sharing Dialog and Control Resources Among Projects

Started by JoeH, May 27, 2025, 11:57:52 PM

Previous topic - Next topic

JoeH

In my efforts to learn how to use CodeBlocks I have developed a number of projects which focus on a specific set of conditions.  Some of the dialog and control configurations I would like to use in other projects.  Is it possible to extract a dialog I have built in one project and "paste" it into another project, or must the dialog be rebuilt from scratch?

Joe

Miguel Gimenez

#1
AFAIK there is no automatic way, but you can do it easily. Suppose you have created MyDialog with sources MyDialog.cpp/MyDialog.h:
  - copy MyDialog.cpp/MyDialog.h to the new project folder
  - copy wxsmith/MyDialog.wxs file to the wxsmith folder in the new project folder
  - edit the project with a text editor and add the source files and the wxs


<Unit filename="MyDialog.cpp" />
<Unit filename="MyDialog.h" />
<Unit filename="wxsmith/MyDialog.wxs" />

  - add in the wxsmith section the line associated to the resource, in this case:


<resources>
    ...
    <wxDialog wxs="wxsmith/MyDialog.wxs" src="MyDialog.cpp" hdr="MyDialog.h" fwddecl="0" i18n="1" name="MyDialog" language="CPP" />
    ...
</resources>

You can use the original project as a guide.

JoeH

Thanks,

      It took me a little bit of poking around in the project files and testing but I got the process you described to work.  This will save me a fair amount of effort.  Thanks again.

Joe