Welcome to wxFormBuilder’s issue tracking system! We hope that wxFormBuilder provides you with many hours of increased productivity.
Please feel free to post bug reports and feature requests here. You can feel free to discuss an issue or feature on the forum but if you decide it needs to be looked at you need to post it here. If a feature request or bug report is not on this site there is a good chance it won’t be worked on. So, as a rule, post them here.
Thanks for your cooperation,
The wxFormBuilder Team
FS#417 - Bitmap relative path
Opened by Victor Martin (jogshy) - Sunday, 15 March 2009, 03:03 GMT+2
|
DetailsI have a problem with the files loaded from relative paths and bitmap buttons/images. Imagine this situation: - You create a new dialog in wxFB. You place a bitmap button with an image “./MyImage.png”. You create the .H. - In your application, you use the .H created by wxFB. - Then, the application asks the user to select a file using a wxFileDialog call. The current folder changes... - Now, I open the wxFB dialog using the “./MyImage.png”... and voilá! A file not found assert is fired... That’s because the current folder changed and, like I specified a “./MyImage.png” as bitmap button’s icon then the error appears correctly... SOLUTION: Add an option in wxFB to use relative-to-application image paths. For example, I could specify for the bitmap button created in wxFB a path like “{AppPath}/MyImage.png”. Then, the dialog’s constructor on your wxFB .CPP output can call something like
this->MyButton->SetIcon(wxTheApp->GetPath()+wxT("/MyImage.png"));
Thanks. |
I have a similar issue with the image paths, I was about to raise a feature request about it and then I saw this.
Since I have my source located in a directory called "Source", and since my final executable builds to a directory called "Bin" and images are found in "Bin/Data/Images"; any paths in the automatically generated code look like "../Bin/Data/Icons/". This actually works ok providing that the executable is ALWAYS in a directory called "Bin", my suggestion would have been to have two paths, one for where you wanted the exported code to be sent (in my case "Source"), and another for your executables working directory (in my case "Bin"), that way the images could be visible in both the wxFormBuilder GUI, and also the final executable.
The issue I can see with the method you described is that wxFormBuilder won't know where you applications working directory will be, so you won't be able to preview the icons in wxFormBuilder.
Actually, now I read that again, you were talking about the current working directory changing at runtime and I was talking about my application not having the same working directory as wxFormBuilders "path" property.
What I said is still a valid concern although we probably need both methods in order to get the functionality into both wxFormBuilder and your final application. If you have a new "working path" property set in wxFormBuilder which would be the same as "wxTheApp→GetPath()" at runtime, then when exporting the C++ code wxFormBuilder can just make all image paths relative to the "working path" and put "wxTheApp→GetPath()" in-front of the path.
Example: "working path" = "Bin/" "image path" = "Bin/Data/Images/add.png" Exported code: "wxTheApp→GetPath() + wxT("/Data/Images/add.png")"
Sorry, the formatting messed up that example a bit and made it hard to read:
"working path" = "Bin/"
"image path" = "Bin/Data/Images/add.png"
Exported code: "wxTheApp→GetPath() + wxT("/Data/Images/add.png")"
Actually, this is a pain because I use bitmaps in toolbars... but wxWidgets does not allow to create a wxToolbarTool without bitmap! So I must create manually all my toolbars...
Unfortunately, it seems wxWidgets does not allow to specify some kind of bitmap search paths ( so if a wxBitmap("myIcon.png") call cannot find the myIcon.png then wxWidgets could locate the bitmap in some alternative folders.... )... So I really need this implemented in wxFormBuilder, pls!
thx
Is there any idea as to when this might happen? I've just re-organised my code layout to make it neater but now since there is two levels of indirection between my source and my bin directories all my icons have stopped working. I can now either only have them visible in the editor, or only have them visible in my actual application.