GTK/wxWidgets gui bug,image problem
Aug 15, 2010 at 2:46am UTC
Thanks in advance for reading this. I am using Ubuntu Linux 10.4 LTS, wxWidgets 2.8, and Gtk 2.* (I'm not sure which version, there are too many packages)
Whenever I run my program no icons are shown. This is a big problem because I need buttons for the toolbar. When I run the program in the terminal here is the output...
1 2 3 4 5
emmanuel@emmanuel-laptop:~/Desktop/c++/wxwdgts/mine$ ./main
(main:9619): Gdk-CRITICAL **: gdk_drawable_get_size: assertion `GDK_IS_DRAWABLE (drawable)' failed
(main:9619): Gdk-CRITICAL **: gdk_drawable_get_depth: assertion `GDK_IS_DRAWABLE (drawable)' failed
And here is the program I compiled.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
#include<wx/wx.h>
#include<wx/toolbar.h>
#include<wx/bitmap.h>
class MyFrame : public wxFrame
{
public :
MyFrame(wxString name);
void OnQuit(wxCommandEvent& event);
};
MyFrame::MyFrame(wxString name) : wxFrame(NULL, wxID_ANY, name, wxDefaultPosition, wxSize(300,300))
{
wxBitmap exit(wxT("exit.png" ));
wxToolBar *mtool = CreateToolBar();
mtool->AddTool((int )wxID_EXIT, exit, wxT("Exit app" ));
mtool->Realize();
Connect(wxID_EXIT, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(MyFrame::OnQuit));
}
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
Close(true );
}
class MyApp : public wxApp
{
public :
virtual bool OnInit();
};
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit()
{
MyFrame *main=new MyFrame(wxT("Submenu" ));
main->Show(true );
return true ;
}
Aug 17, 2010 at 3:01am UTC
Topic archived. No new replies allowed.