Page 1 of 1

Assigning a program icon

Posted: Tue Feb 05, 2008 1:26 am
by Disch
This seems like such a simple question, but I've been looking all day and I can't find anything that directly addresses it either in the docs, on the wiki, or on these forums (or I'm just doing a bad job of searching -- which is possible).

I want to assign my executable an icon, so that the icon appears in the upper-left corner of the main frame and on the task bar (in Windows), and wherever else appropriate (on other platforms). Having the binary be assigned its own icon when viewed via Explorer (or whatever window manager) would be nice too, but is less important to me.

Currently, on Windows, I just have the generic Windows logo on the main window and in the taskbar (which is the default if you don't assign one).

I have looked at wxTaskBarIcon, but unless I'm misunderstanding, that looks like it's for creating an entry in the system tray, which I am not interested in.

I have searched both wxWindow and wxFrame class outlines for the intuitive "SetIcon" function, but have found nothing of the sort.

Does wx allow for this? If so how can it be accomplished? Note that while I am currently coding on Windows, I am not interested in any solution that is Windows specific (doing OS specific things kind of completely defeats the point of using a lib like wx, IMO).

Thanks in advance.

Posted: Tue Feb 05, 2008 2:03 am
by mc2r
Look at wxTopLevelWindow::SetIcon()

also you can set the default app on msw by adding this to the a .rc file for the app.

appicon ICON "some_icon.ico"

This thread shows both in use.

http://forums.wxwidgets.org/viewtopic.p ... ation+icon

-Max

Posted: Tue Feb 05, 2008 2:15 am
by Disch
mc2r wrote:Look at wxTopLevelWindow::SetIcon()
*feels dumb*

forgot all about wxTopLevelWindow >_<

Ah well, I knew it was something simple. Thanks.