I re-compiled some code (initially developed under Fedora11 and fltk-1.1.9-4) 
now rebuild under Fedora15 with fltk-1.1.10-6.

I am a newbee to fltk. Anything my code is doing wrong?

Unfortunately the Fedora 15 coredumps, It opens up fine and displays. When I 
resize the window, the window is updated promptly. But when I release the mouse 
it coredumps:

   gdb fltest core.xxxx
#0  0x000000c4 in ?? ()
#1  0x080512ef in fl_fix_focus() ()
#2  0x080514d9 in Fl::handle(int, Fl_Window*) ()
#3  0x0806cf50 in fl_handle(_XEvent const&) ()
#4  0x0806df5e in do_queued_events() ()
#5  0x0806e191 in fl_wait(double) ()
#6  0x08052680 in Fl::wait(double) ()
#7  0x080527ee in Fl::run() ()
#8  0x0804f281 in main (argc=1, argv=0xbf849f24) at 
/home/mattes/src/amb/fltest/main.cpp:977

Here the code that makes it dump:

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Browser.H>

static int data_colpercent[] = {4, 7, 10, 17, 6, 10, 6, 10, 12};
static int data_widths[] = {50, 50, 50, 70, 70, 40, 40, 70, 70};

class myBrowser : public Fl_Browser {

public:
    myBrowser( int X,int Y,int W,int H,const char*L=0) : Fl_Browser(X,Y,W,H,L) 
{};

protected:
    //    If window reshapes, readjust columns width in browser
    void resize( int x, int y, int w, int h ) {
        // adjust all columns
        for ( int i=0; i< sizeof(data_colpercent); i++ ) {
           data_widths[i] = w * data_colpercent[i] /100;
        }
        Fl_Browser::column_widths( data_widths );

        //printf("d wh=%dx%d\n", w,h );
        Fl_Browser::resize(x,y,w,h);
    }
};

int main( int argc, char **argv)
{
   Fl_Window  *w = new Fl_Window(900,300);
   myBrowser *b = new myBrowser(5,5,w->w()-5,w->h()-5);

   b->column_widths( data_widths );
   b->column_char('\t');
   b->type(FL_MULTI_BROWSER);

   b->add("P\t##\tclass\tTEAM\tLaps\tbestTime\tbl\tlastLap\tdiff");
   b->add("4\t13l\tF200\twunder\t134\t39.981\t35\t40.66\t1L 15.55");
   b->add("5\t3p\tWF\tSunshine\t133\t40.859\t123\t41.23\t2L 7.30");
   b->add("7\t23\tclone\tARC\t129\t43.723\t17\t44.300\t6L 31.50");
   b->add("8\t17\tWF\tsandflats\t125\t41.076\t67\t41.836\t10L 39.31");

   //b->textsize(17);
   b->has_scrollbar(0);

   w->resizable(b);
   w->end();
   w->show();
   return(Fl::run());
}

_______________________________________________
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to