Author
Topic: questions about wxsmith in CB (Read 1889 times)

After finally I was able to build wxWidgets 3.0.2 I can make GUIs using wxSmith integrated into CodeBlocks. Making a frame project is really not a problem, but I would like to create custom dialogs inside that frame project. Have used wxDev befor and adding such custom dialogs to a frame project was no problem there. Is there a way to do that in CodeBlocks?

So have an other question. Have added an icon to my wxFrame and when I start the application in CB everything worcks fine, but when started the compiled exe on an other PC got the error mesage about mising icon. Have used wxDev befor and there this icon was compiled into exe, is there a way to do that in CB to?

For the codeblocks part:I don't know how exactly codeblocks uses the resource compiler and if mingw ships with one... But at a first test you can simply try to add a resource file with the appropriate extension to the project and cross fingers. Maybe it works... if not we have to look into it.I have no windows machine at the hand so i can't test it...

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:

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 worck on any other PC.

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

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.ico2) But if you run your app directly without codeblocks it will search in the application base folder:PATH_TO_YOUR_EXECUTABLE_FILE\res\myicon.icoso if you run it outside codeblocks but in the folder structure of codeblocks:PATH_TO_YOUR_PROJECT_BASE_FOLDER\bin\debug\res\myicon.icoThis 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.

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:

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

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.ico2) But if you run your app directly without codeblocks it will search in the application base folder:PATH_TO_YOUR_EXECUTABLE_FILE\res\myicon.icoso if you run it outside codeblocks but in the folder structure of codeblocks:PATH_TO_YOUR_PROJECT_BASE_FOLDER\bin\debug\res\myicon.icoThis 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.

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.

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:

yes. BUT you should read the link he posted... Your image is useless. Please follow exactly the steps in the link. And if you have no luck, follow EXACTLY the last step:

Quote

f you have no luck, you can try to ask in the forum, but read first "How do I report a compilation problem on the forums"

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.

By embedding i mean to build into the exe, so you don't have to ship a .ico file, but it is packed into the exe

Have you tried the relative paths?

Not really familiar with that build stuff, so this was already a problem in previous discusion with Tim, and even googletranslator is not helpfull in this case.I havenīt tried your code with relative path, but have just tried to edit the code line to:

FrameIcon.CopyFromBitmap(wxBitmap(wxImage(_T("myicon.ico"))));The icon is in the prject folder, so it worcked, but with this solution I still need to destribute the icon with the exe and this is something I donīt want to do. wxDev has put the frame icon into the exe to and after looking exactlly at the code produced by wxDev, looks like it is using something similar, or may be exactly the same, to xpm. So looks like I have to generate .xpm file from the icon and than include somehow that .xpm file.Also I read in the documentation something about windows handels, no idea if this could be a solution, as im worcking only on Windows and this is the only target OS.

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:

You need to post the full build log in code tags; NOT an image of the build message.

Anyone, know of a site that translates the CB FAQs to multiple languages?

Tim S.

I read the link you posted here, but like I said I am not familiar with all that comandline stuff, so it a bit dificult to understand even after translating into my own language. I can compile a .c/.cpp file with g++ but that all my knowledge about comandline, everithing going over that is not compatible with my skills. I was really not joking when saing, that it took me 1,5 month to build wxWidgets.The image, I posted is everithing I can see after the compilation is finished, no meter succesfull or not. During the compilation, I can see all that comands, mentioned in that FAQ, but they are away after compiler has finished.Also for me personally the error mesage make sence, as "aaaa" wasnīt really declared, exept in the .rc file, but that file seems not to be conected to the sources.

Also for me personally the error mesage make sence, as "aaaa" wasnīt really declared, exept in the .rc file, but that file seems not to be conected to the sources.

yes... the compiler needs to know where to find the resource file, but we don't know where the compiler searches. This is all displayed in the compiler command line and the command line is posted in the "build log" tab and not in the "build message" tab. You posted the later and this has no usefull information for us.

We told you 100 times to read ALL the faq... Sometimes you simply have to follow ALL instructions and don't complain, or think this is not related to you...

Also for me personally the error mesage make sence, as "aaaa" wasnīt really declared, exept in the .rc file, but that file seems not to be conected to the sources.

yes... the compiler needs to know where to find the resource file, but we don't know where the compiler searches. This is all displayed in the compiler command line and the command line is posted in the "build log" tab and not in the "build message" tab. You posted the later and this has no usefull information for us.

We told you 100 times to read ALL the faq... Sometimes you simply have to follow ALL instructions and don't complain, or think this is not related to you...

Like i said not familiar with the comandline, so I sought what I posted must be the "build log". However I thinK to know where the problem was, I have to use the wxICON macro and I typed it wrong, so itīs recognized as a constructor. The corect line must look like this:

Frame->SetIcon(wxICON(aaaa));Really stupied error, will tell tomorow if it worcked.

Like expected, it worcked. So now I am really looking like an idiot, sorry for wasting everibodies time. Think I have worcked with maxscript, which is kase insensible, to often. So just to explain, in maxscript is wxICON and wxIcon exactlly the same, but not in C++.