User forums > General (but related to Code::Blocks)

Sharing Dialog and Control Resources Among Projects

(1/1)

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:
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


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

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


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

--- End code ---
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

Navigation

[0] Message Index

Go to full version