Author Topic: Adding existing wxsmith dialog to project  (Read 3089 times)

Offline Rocketrrt

  • Single posting newcomer
  • *
  • Posts: 3
Adding existing wxsmith dialog to project
« on: October 18, 2016, 04:18:12 pm »
Hi,

I created a wxsmith dialog in a project I have, already had 40 dialogues in it. It did not save the new files in the project (not sure why)  All the files are there(cpp, h and wxs) in correct directories.  I can easily add the cpp and h file the project no problem.  How do I add the wxs (dialog) file to the Resources so I can edit the dialog using CodeBlocks.  I have tried to add the file like I would with cpp and h files and it adds it to the Resources under projects but when I try to edit it it comes up as XML file, not in the dialog editor.

Any help would be appreciated.

Thanks,
Ron

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Adding existing wxsmith dialog to project
« Reply #1 on: October 19, 2016, 11:40:19 pm »
This is a bit tricky...
sadly i don't know any ui to do this. @dev: Is there any?

You have to edit the project file by yourself:
1) Make a copy of the target project file
2) Copy all needed files (xrc, cpp, h, wxs) to the right locations
3) Open the start project file with a editor (notepad++ or notepad)
4) Copy the the right line from the Extensions->wxsmith part:
Code
		<Extensions>
<code_completion />
<envvars />
<debugger />
<lib_finder disable_auto="1" />
<wxsmith version="1">
<gui name="wxWidgets" src="fdgfdhgfApp.cpp" main="fdgfdhgfDialog" init_handlers="necessary" language="CPP" />
<resources>
<wxDialog wxs="wxsmith/fdgfdhgfdialog.wxs" src="fdgfdhgfMain.cpp" hdr="fdgfdhgfMain.h" fwddecl="0" i18n="1" name="fdgfdhgfDialog" language="CPP" />
<wxDialog wxs="wxsmith/NewDialog.wxs" src="NewDialog.cpp" hdr="NewDialog.h" xrc="NewDialog.xrc" fwddecl="0" i18n="1" name="NewDialog" language="CPP" />
</resources>
</wxsmith>
</Extensions>
to the target project file in the same location

for example if you want to add the dialog NewDialog.wxs to the new project copy the line
Code
<wxDialog wxs="wxsmith/NewDialog.wxs" src="NewDialog.cpp" hdr="NewDialog.h" xrc="NewDialog.xrc" fwddecl="0" i18n="1" name="NewDialog" language="CPP" />

5) Save project file and open it in codeblocks
6) Add all files to the target project via the codeblocks ui

hope this helps

greetings

Offline Rocketrrt

  • Single posting newcomer
  • *
  • Posts: 3
Re: Adding existing wxsmith dialog to project
« Reply #2 on: October 20, 2016, 05:47:24 pm »
This worked!!! 

Thank you very much!!

Ron

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Adding existing wxsmith dialog to project
« Reply #3 on: October 21, 2016, 11:23:51 am »
Bluehazzard: I don't remember if there is an UI for this, but it will be good if we have this. Because I think I've done the same editing steps in the past.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Rocketrrt

  • Single posting newcomer
  • *
  • Posts: 3
Re: Adding existing wxsmith dialog to project
« Reply #4 on: October 21, 2016, 03:04:08 pm »
Hi,

I also found another way to do this, but I think the way first posted is the fastest.  The other way is save all the files (.cpp .h and wxs) off some where else or rename them.  Then in code::blocks create a new dialog with the same name save and exit and copy or rename the files that we saved overwriting the new files created. I was just playing around and tried this and it worked also.

Ron