Author Topic: Sharing Dialog and Control Resources Among Projects  (Read 438 times)

Offline JoeH

  • Single posting newcomer
  • *
  • Posts: 4
Sharing Dialog and Control Resources Among Projects
« on: May 27, 2025, 11:57:52 pm »
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

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1722
Re: Sharing Dialog and Control Resources Among Projects
« Reply #1 on: May 28, 2025, 11:38:01 am »
AFAIK there is no automatic way, but you can do it easiliy. 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" />
  - 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="NewDialog" language="CPP" />
    ...
</resources>
You can use the original project as a guide.
« Last Edit: Yesterday at 07:02:10 pm by Miguel Gimenez »

Offline JoeH

  • Single posting newcomer
  • *
  • Posts: 4
Re: Sharing Dialog and Control Resources Among Projects
« Reply #2 on: Yesterday at 05:54:50 pm »
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