Hi,

I've recently taken to experimenting with this graphics library and have had 
some success with it so far. I'm developing my own application with the limited 
knowledge that I have of programming but consider myself an intermediate 
programmer.

Anyways, I have this problem where I can't get this window to pop up when I 
initiate the callback for it. I have written the situation that I am having 
problems with and hopefully somebody out there can show me where I went wrong.

You can copy and paste this example into a text editor and compile and link it 
yourself. The error is a run-time error, I just can't figure it out.

Thanks so much!
Kjell



#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Button.H>

void Button_CB(Fl_Widget* w, void* v);

class TestWin : public Fl_Double_Window
{
public:
        TestWin(int w, int h, const char* c);
        ~TestWin();

        Fl_Double_Window*       Win;

        Fl_Button*              But;
        Fl_Double_Window*       NuWin;
};

int main()
{
        Fl_Double_Window* Win = new Fl_Double_Window(150,150, "Test");
        Win->begin();

        Fl_Button* But = new Fl_Button(40, 50, 75, 30, "CB Test");
        Fl_Window* NuWin = new Fl_Window(50, 100, "Hooray!");
        But->callback(Button_CB);

        Win->end();
        Win->show();
        return Fl::run();
}

void Button_CB(Fl_Widget* w, void* v)
{
        TestWin* tWin = (TestWin*)v;
        tWin->NuWin->show();
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to