User forums > Help

questions about wxsmith in CB

<< < (2/4) > >>

gtafan:
To be really precise it´s a wxSmith question, but as far I know wxSmith is some kind of CodeBlocks plugin, so the question is in some way related to CodeBlocks.
With resource file you are meaning that .rc file, right? That .rc file contain the icon for exe, and it worcks without big problems, the only thing that can be called problem there, is the fact that the name of the icon must be set manually.
For seting the icon of a frame there is an other way in wxSmith:





and after I have selected the icon some code like that is generated:


--- Code: ---wxIcon FrameIcon;
FrameIcon.CopyFromBitmap(wxBitmap(wxImage(_T("C:\\<path>\\myicon.ico"))));
SetIcon(FrameIcon);

--- End code ---
<path> stands for the full path, and this is exactly the problem preventing it to worck on any other PC.

The solution from this thred: http://forums.codeblocks.org/index.php/topic,9047.new.html#new doesn´t worck, as I also wrote there.

stahta01:
If you post a full build log, someone might see the cause of your issue!
http://wiki.codeblocks.org/index.php/FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

BlueHazzard:

--- Quote ---nd after I have selected the icon some code like that is generated:

Code:

wxIcon FrameIcon;
FrameIcon.CopyFromBitmap(wxBitmap(wxImage(_T("C:\\<path>\\myicon.ico"))));
SetIcon(FrameIcon);

<path> stands for the full path, and this is exactly the problem preventing it to work on any other PC.

--- End quote ---
of course this won't work. But you should also be able to put relative paths there. Something like _T("res\\myicon.ico")
If you use this approach there are some codeblocks pitfalls:
1) If you run your app within codeblocks your app will search in the project folder for the "res" subfolder:
PATH_TO_YOUR_PROJECT_BASE_FOLDER\res\myicon.ico
2) But if you run your app directly without codeblocks it will search in the application base folder:
PATH_TO_YOUR_EXECUTABLE_FILE\res\myicon.ico
so if you run it outside codeblocks but in the folder structure of codeblocks:
PATH_TO_YOUR_PROJECT_BASE_FOLDER\bin\debug\res\myicon.ico
This is because codeblocks has two targets: build and release and if you make the search path for resources (all relative paths of your app) the base path of the project you don't have to copy the resources into two folders. Of course there is a setting to change this...

As i told you above i have no idea how to embed the icon into the exe. But if you post a full build log how stahta01 suggested maybe we can help you.

gtafan:

--- Quote from: stahta01 on April 19, 2017, 12:10:08 am ---If you post a full build log, someone might see the cause of your issue!
http://wiki.codeblocks.org/index.php/FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

--- End quote ---
You are asking for error mesages produced by compiler, right?
If I am using wxSmith to add icon to frame, there is no error mesages, but geting runtime erors on every other PC. The reason for that runtime errors is known, so no need to diskus it, as such solution is useles for me.
when I try your solution from that thread the error mesage looks like that:



Line 30 in that .cpp file looks like this:


--- Code: ---Frame->SetIcon(wxIcon(aaaa));
--- End code ---

in the .rc file there is a line like this:


--- Code: ---aaaa ICON "myicon.ico"
--- End code ---

Sorry if I misunderstood you again.

gtafan:

--- Quote from: BlueHazzard on April 19, 2017, 10:19:04 am ---
--- Quote ---nd after I have selected the icon some code like that is generated:

Code:

wxIcon FrameIcon;
FrameIcon.CopyFromBitmap(wxBitmap(wxImage(_T("C:\\<path>\\myicon.ico"))));
SetIcon(FrameIcon);

<path> stands for the full path, and this is exactly the problem preventing it to work on any other PC.

--- End quote ---
of course this won't work. But you should also be able to put relative paths there. Something like _T("res\\myicon.ico")
If you use this approach there are some codeblocks pitfalls:
1) If you run your app within codeblocks your app will search in the project folder for the "res" subfolder:
PATH_TO_YOUR_PROJECT_BASE_FOLDER\res\myicon.ico
2) But if you run your app directly without codeblocks it will search in the application base folder:
PATH_TO_YOUR_EXECUTABLE_FILE\res\myicon.ico
so if you run it outside codeblocks but in the folder structure of codeblocks:
PATH_TO_YOUR_PROJECT_BASE_FOLDER\bin\debug\res\myicon.ico
This is because codeblocks has two targets: build and release and if you make the search path for resources (all relative paths of your app) the base path of the project you don't have to copy the resources into two folders. Of course there is a setting to change this...

As i told you above i have no idea how to embed the icon into the exe. But if you post a full build log how stahta01 suggested maybe we can help you.

--- End quote ---
Just wan to make one thing clear, have no problem with embading icon into exe, the problem is only with the icon for the frame.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version