User forums > Using Code::Blocks

Adding a wxs file to project

(1/3) > >>

Redixe:
I used the wxSmith add dialog to add a few dialogs to the project. Because of the way things are setup, when I lost connection to our server the files weren't saved to the project. I still had the .cpp, .h, and .wxs files. I just to C::B to add them to the project. Now, when I try to view the dialog all I get is the text version. How can I add it back where I can view it and add stuff to it with wxSmith?

byo:
There's special function exported in scripting engine dedicated for recovering of such files. To recover file do the following:

* Open Project with missing resources
* Open scripting console (available under view menu)
* Enter command in the following form:

For resource not using xrc file:

--- Code: ---WxsRecoverWxsFile(_( "[RESOURCE_TYPE] wxs=\"[WXS_FILE_NAME]\" src=\"[SRC_FILE_NAME]\" hdr=\"[HDR_FILE_NAME]\" name=\"[RESOURCE_NAME]" language=\"CPP\" "));

--- End code ---

For resource using xrc file:

--- Code: ---WxsRecoverWxsFile(_( "[RESOURCE_TYPE] wxs=\"[WXS_FILE_NAME]\" src=\"[SRC_FILE_NAME]\" hdr=\"[HDR_FILE_NAME]\" xrc=\"[XRC_FILE_NAME]\" name=\"[RESOURCE_NAME]" language=\"CPP\" "));

--- End code ---


where:

[RESOURCE_TYPE] - is name of wxWidgets class of this resource (for example wxFrame)
[WXS_FILE_NAME] - is name of wxs file containing resource definition (include the wxsmith directory name, for example: wxsmith/frame1.wxs)
[SRC_FILE_NAME] - is name of .cpp file dedicated for the resource
[HDR_FILE_NAME] - is name of .h file dedicated for the resource
[XRC_FILE_NAME] - is name of .xrc file (if used)
[RESOURCE_NAME] - is name of resource as shown in wxSmith panel (generally it's name of resouce's class)

For example if you have created resource called NewFrame (source file: NewFrame.cpp, header: NewFrame.h, wxs: wxsmith/NewFrame.wxs) simply call from the scrip console:


--- Code: ---WxsRecoverWxsFile(_( "wxFrame wxs=\"wxsmith/NewFrame.wxs\" src=\"NewFrame.cpp\" hdr=\"NewFrame.h\" name=\"NewFrame\" language=\"CPP\"  " ));
--- End code ---

Now if the resource uses xrc file, add extra argument notifying about such file:

--- Code: ---WxsRecoverWxsFile(_( "wxFrame wxs=\"wxsmith/NewFrame.wxs\" src=\"NewFrame.cpp\" hdr=\"NewFrame.h\" xrc=\"NewFrame.xrc\" name=\"NewFrame\" language=\"CPP\"  " ));
--- End code ---

Hope this will help :)

Regards
   BYO

Redixe:
Getting an Error:

--- Quote ---Filename: ScriptConsole
Error: the index 'WxsRecoverWxsFile' does not exist
Details:
AN ERROR HAS OCCURED [the index 'WxsRecoverWxsFile' does not exist]

CALLSTACK
*FUNCTION [main()] ScriptConsole line [1]

LOCALS
[this] TABLE
--- End quote ---

I ran this command

--- Code: ---WxsRecoverWxsFile(_( "wxDialog wxs=\"wxsmith/keyboard.wxs\" src=\"keyboard.cpp\" hdr=\"keyboard.h\" name=\"keyboard\" language=\"CPP\" "));
--- End code ---

Jenna:
Which version of C::B do you use ?


--- Quote ---wxSmith:
* Exported 'WxsRecoverWxsFile' function into squirrel - it may be used to recover resources when they were lost
* Fix potential crash when loading project with invalid resource definitions

--- End quote ---

Quote from changelog for svn r5042.

If you use an older version (stable 8.02 included) "WxsRecoverWxsFile" is unknown.

Redixe:
I am using 8.02

Navigation

[0] Message Index

[#] Next page

Go to full version