Page 1 of 1

Set an icon to my app

Posted: Sun May 06, 2007 6:52 pm
by ne01982
Hi everyone.

My main windown inherits from wxApp.

How can I change the icon off my app?

Thanks

Re: Set an icon to my app

Posted: Sun May 06, 2007 7:39 pm
by JSThePatriot
ne01982 wrote:Hi everyone.

My main windown inherits from wxApp.

How can I change the icon off my app?

Thanks
It is different for different OS's. For windows you need a resource file. (appResources.rc or something ;))

My resource file

Code: Select all

aaaa ICON xpbn.ico

#include <wx/msw/wx.rc>
And again in the application just incase

Code: Select all

mainFrame->SetIcon( wxICON(aaaa) ); // To Set Application Icon
I have that in my MyApp::OnInit().

JS

Posted: Mon May 07, 2007 9:39 am
by BigFreeze
Hi,

you can do also sth like that, it is nearly the same solution, JS posted before:

Code: Select all

#include "pics/icon.xpm"
and somewhere in OnInit() or the frame constructor:

Code: Select all

SetIcon(icon_xpm);
XPM files save the picture data in sth like a structure, and icon_xpm is its name.

Best regards, BigFreeze

Posted: Mon May 07, 2007 5:59 pm
by JSThePatriot
BigFreeze wrote:Hi,

you can do also sth like that, it is nearly the same solution, JS posted before:

Code: Select all

#include "pics/icon.xpm"
and somewhere in OnInit() or the frame constructor:

Code: Select all

SetIcon(icon_xpm);
XPM files save the picture data in sth like a structure, and icon_xpm is its name.

Best regards, BigFreeze
Do you get that to work in Windows? I am unable to. I wish all the OS's could accept XPM's. It's a bit annoying trying to get each OS's icons worked out.

Thanks,
JS

Posted: Tue May 08, 2007 7:26 am
by BigFreeze
Do you get that to work in Windows? I am unable to. I wish all the OS's could accept XPM's. It's a bit annoying trying to get each OS's icons worked out
.

Yes, it works fine with Windows and Linux. I have no problems.

I supposed, the acception of XPM's is a part, wxWidgets has to manage and not the OS. Maybe I'm wrong, but it seems, that XPM work better on different platforms than other types of images like JPEG, because it stores the data in sth like a structure. I think, to handle this kind of storage is part of the programs (picture editing software, I use GIMP) and not the OS.

Best regards, BigFreeze

Posted: Tue May 08, 2007 4:04 pm
by JSThePatriot
I use it just as you have described, and for windows I still have to have a resource file if I want the icon in the task bar/manager. I would love if I am doing something wrong, and I dont need the resource file.

Thanks,
JS