testalucida
2013-04-13 21:47:57 UTC
Hi all,
can someone explain, what's wrong with this code? There's no FL_DRAG event upcoming in the Box class:
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Box.H>
#include <stdio.h>
class Box : public Fl_Box {
public:
Box( int x, int y, int w, int h )
: Fl_Box( x, y, w, h )
{
box( FL_UP_BOX );
color( fl_lighter( FL_YELLOW ) );
}
protected:
int handle( int evt ) {
int rc = Fl_Box::handle( evt );
if( evt == FL_DRAG ) {
printf( "dragging\n", evt );
return 1;
}
return rc;
}
};
int main() {
Fl_Double_Window *pWin = new Fl_Double_Window( 500, 500, "Dragging" );
Fl_Group *pGrp = new Fl_Group( 0, 0, 500, 500 );
pGrp->box( FL_FLAT_BOX );
pGrp->color( fl_lighter( FL_GRAY ) );
pGrp->begin();
Box *pBox = new Box( 50, 50, 200, 25 );
pGrp->end();
pWin->end();
pWin->resizable( pWin );
pWin->show();
return Fl::run();
}
Thanks & bye
testalucida
can someone explain, what's wrong with this code? There's no FL_DRAG event upcoming in the Box class:
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Box.H>
#include <stdio.h>
class Box : public Fl_Box {
public:
Box( int x, int y, int w, int h )
: Fl_Box( x, y, w, h )
{
box( FL_UP_BOX );
color( fl_lighter( FL_YELLOW ) );
}
protected:
int handle( int evt ) {
int rc = Fl_Box::handle( evt );
if( evt == FL_DRAG ) {
printf( "dragging\n", evt );
return 1;
}
return rc;
}
};
int main() {
Fl_Double_Window *pWin = new Fl_Double_Window( 500, 500, "Dragging" );
Fl_Group *pGrp = new Fl_Group( 0, 0, 500, 500 );
pGrp->box( FL_FLAT_BOX );
pGrp->color( fl_lighter( FL_GRAY ) );
pGrp->begin();
Box *pBox = new Box( 50, 50, 200, 25 );
pGrp->end();
pWin->end();
pWin->resizable( pWin );
pWin->show();
return Fl::run();
}
Thanks & bye
testalucida