hi all,
on Erco's Cheatpage I found an image drawing example which works fine:
//-----------------------------------------------------//
int main() {
fl_register_images(); // initialize image lib
Fl_Window win(720,486);
win.box( FL_DOWN_BOX );
Fl_Box box( 0, 0, 100, 25 );
box.box( FL_FLAT_BOX );
box.color( FL_DARK3 );
Fl_PNG_Image
jpg("/home/maxmeier/projects/cpp/fltk/MyFltk/myfltk/close.png");
box.image(jpg);
win.show();
return(Fl::run());
}
//-----------------------------------------------------//
I modified this example so that the image drawing isn't done in the main method
anymore but in a separate class.
This results in a segmentation fault.
Can anyone explain the reason?
//-----------------------------------------------------//
class MyWindow : public Fl_Double_Window {
public:
MyWindow( int x, int y, int w, int h ) : Fl_Double_Window( x, y, w, h ) {
fl_register_images(); //initialize image lib
box( FL_DOWN_BOX );
Fl_Box *pBox = new Fl_Box( 5, 50, 100, 25 );
pBox->box( FL_FLAT_BOX );
pBox->color( FL_DARK3 );
Fl_PNG_Image png(
"/home/maxmeier/projects/cpp/fltk/MyFltk/myfltk/close.png");
pBox->image( png );
end();
}
};
int main() {
MyWindow win( 100, 100, 700, 500 );
win.show();
return (Fl::run());
}
//-----------------------------------------------------//
Thanks in advance
bye
testalucida
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk