On 07/21/11 14:16, Percy wrote:
> Hi, I'm using FLTK 1.3.x r8861 with VS2008. I'm having a lot of trouble 
> working with the Fl_Table class' add function. Here's some code:
> 
> ////////////////////////////////////////////
>   Fl_Window win( 800, 600, "Window" );
>   win.end();
> 
>   // MyTable inherits from Fl_Table
>   MyTable* t = new MyTable( 400, 0, 400, 600 );
>   t->end();
>   win.add( t );
>   t->rows( 10 );
>   t->cols( 2 );
>   for ( int r = 0; r < t->rows(); r++ )
>   {
>     for ( int c = 0; c < t->cols(); c++ )
>     {
>       int X,Y,W,H;
>       t->cell_dimensions( r, c, X, Y, W, H );
>       Fl_Widget* w = new Fl_Button( X, Y, W, H, "Table Widget" );
>       t->add( w );
>     }
>   }
>   //t->end(); // if I add this line, it works, even though t->end() was 
> already called
> 
>   win.resizable( win );
>   win.show();
>   return Fl::run();
> ////////////////////////////////////////////
> 
> I can get this to work normally if I use the normal begin()-end() setup or if 
> (for some reason) I add the the extra t->end(). It seems as though add() does 
> not work. I know that begin() and end() work, but for my particular 
> application, add() is much more convinient.
> 
> And just to clarify, MyTable overrides only the constructor, destructor and 
> draw_cell. If also has a public function cell_dimensions, which simply calls 
> find_cell.

   Can I see a more complete, compilable program so that I can replicate.
   eg. the complete definition of the MyTable class, including the definition
   of the method cell_dimensions().

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to