Beginner - Icon trouble! [SOLVED]
Posted: Sun Jun 15, 2008 7:30 pm
Hi!
I'm a complete beginner with WxWidgets. I just build it yesterday but so far I really like what I see!
I followed this tutorial, just for fun trying to create an icon:
http://zetcode.com/tutorials/wxwidgetst ... tprograms/
I don't have the web.xpm so I just grabbed another xpm-file (mondrian.xpm) from WxWidget sample-folder and I put it in my working directory. And in the code I change from SetIcon(wxIcon(wxT("web.xpm"))) to SetIcon(wxIcon(wxT("mondrian.xpm"))). Anyways, here is the code:
Thank you in advance!
/DT
I'm a complete beginner with WxWidgets. I just build it yesterday but so far I really like what I see!
I followed this tutorial, just for fun trying to create an icon:
http://zetcode.com/tutorials/wxwidgetst ... tprograms/
I don't have the web.xpm so I just grabbed another xpm-file (mondrian.xpm) from WxWidget sample-folder and I put it in my working directory. And in the code I change from SetIcon(wxIcon(wxT("web.xpm"))) to SetIcon(wxIcon(wxT("mondrian.xpm"))). Anyways, here is the code:
Code: Select all
//icon.h
#include <wx/wx.h>
class Icon : public wxFrame
{
public:
Icon(const wxString& title);
};
Code: Select all
//main.h
#include <wx/wx.h>
class MyApp : public wxApp
{
public:
virtual bool OnInit();
};
Code: Select all
//icon.cpp
#include "icon.h"
Icon::Icon(const wxString& title)
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(250, 150))
{
SetIcon(wxIcon(wxT("mondrian.xpm")));
Centre();
}
Code: Select all
//main.cpp
#include "main.h"
#include "icon.h"
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit()
{
Icon *icon = new Icon(wxT("Icon"));
icon->Show(true);
return true;
}
/DT