Hi all,
I'm new in the FLTK and C++.
my problem is do not acces a widget in the class.
Any idea ?
Thanks,
*my error code *
g++ -O2 -Wall -Wno-deprecated -c boton.cxx -o boton.o
boton.cxx: In static member function ‘static void test::callback(Fl_Button*,
void*)’:
boton.cxx:18: error: invalid use of member ‘test::win’ in static member
function
boton.cxx:56: error: from this location
*My code *
#include <iostream>
#include <cstdlib>
#include <stdio.h>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Widget.H>
#include <FL/Fl_Output.H>
#include <FL/Fl_Input.H>
using namespace std;
class test {
Fl_Window *win;
Fl_Button *Boton;
Fl_Button *BA;
public:
test( const char *name);
~test();
private :
static void callback( Fl_Button* o, void *datos );
};
test::test( const char *name)
{
win = new Fl_Window( 640,480, name );
win->resizable(win);
win->begin();
{
Boton = new Fl_Button( 5, 5, 140, 30, "Click" );
Boton->callback( (Fl_Callback*) &callback );
}
win->end(); // cierra la ventana, no mas widgets
win->show();
}
test::~test( )
{
printf("Destroy object \n");
}
void test::callback( Fl_Button* o, void *datos )
{
win->label("the new label of window ! ");
}
int main(int argc, char **argv) {
test *t;
t = new test("THE THEST");
return Fl::run();
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk