Thank you for your help! I got a lot further, but still not completely there. I 
now have a window coming up. When it comes up, it has the "hello world" widget 
inside, but when I close the window using the window-manager's close button (X 
decoration), the console produces "X I/O error".

bash-3.1$ ./fltktest
X I/O error
bash-3.1$


#include <fltk/Window.h>
#include <fltk/run.h>
#include <fltk/x11.h>
#include <X11/Xlib.h>
#include <unistd.h>

class twindow : public fltk::Window {
public:
        twindow(int x, int y) : fltk::Window(x,y) {

        }

        virtual ~twindow() {}
        virtual void create() {
                fltk::open_display();
                XWindow win = XCreateSimpleWindow(fltk::xdisplay, 
RootWindow(fltk::xdisplay, fltk::xscreen), 0, 0, 500, 500, 0, 0, 0);
                XMapWindow(fltk::xdisplay, win);
                XFlush(fltk::xdisplay);
                fltk::CreatedWindow::set_xid(this, win);
        }
};

int main(int argc, char* argv[]) {
        twindow x(500,500);
        x.begin();
        fltk::Widget *box = new fltk::Widget(20, 40, 260, 100, "Hello, World!");
        box->box(fltk::UP_BOX);
        box->labelfont(fltk::HELVETICA_BOLD_ITALIC);
        box->labelsize(36);
        box->labeltype(fltk::SHADOW_LABEL);
        x.end();
        x.show();
        fltk::run();
        return 0;
}



>
>
> Whoops=2C don't know how I missed this this morning.
>
> You don't need a fancy patch or anything like that.
> Since fltk hasn't technically opened the display with your CreatedWindow=2C=
>  before the show() you need to call fltk::open_display()
>
> There's a good example next to fltk::Window::create()=2C in the documentati=
> on!
>
_______________________________________________
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to