I reproduced my problem with a minimum of code.
IMHO the order of the draw() methods should follow Edzard's suggestion.
This ist the main method:
----------------------------------------------------------------
#include "testgroup.hpp"
int main(int argc, char **argv) {
Fl_Double_Window * pMainWin = new Fl_Double_Window( 500, 500, "Not
Opaque Demo" );
pMainWin->box( FL_FLAT_BOX );
{
TestGroup * pGrp = new TestGroup( 0, 0, 500, 500 );
}
pMainWin->end();
pMainWin->show();
Fl::run();
}
-------------------------------------------------------------------
..the TestGroup class (the TestRect is added within the ctor):
#ifndef _TESTGROUP_HPP_
#define _TESTGROUP_HPP_
#include <FL/fl_draw.H>
#include "testrect.hpp"
class TestGroup : public Fl_Group {
protected:
void draw() {
Fl_Group::draw();
drawHorizontalLines( x(), y(), w(), h() );
drawVerticalLines(x(), y(), h(), w() );
}
public:
TestGroup( int X,int Y,int W,int H ) : Fl_Group( X, Y, W, H )
{
align(FL_ALIGN_CENTER);
box(FL_FLAT_BOX);
====>>> TestRect *pRect = new TestRect( 80, 80, 110, 110 ); <<<=====
end();
}
private:
void drawHorizontalLines( int startX, int startY, int len, int height )
{
int rh = 100;
int endX = startX + len;
fl_color( FL_BLACK );
for( int dy = 0; dy < height; dy += rh ) {
int y = startY + dy;
fl_line( startX, y, endX, y );
}
}
void drawVerticalLines( int startX, int startY, int len, int width ) {
int cw = 100;
int endY = startY + len;
fl_color( FL_BLACK );
for( int dx = 0; dx < width; dx += cw ) {
int x = startX + dx;
fl_line( x, startY, x, endY );
}
}
};
#endif
------------------------------------------------------------------
..and finally the TestRect class:
#ifndef _TestRect_HPP
#define _TestRect_HPP
#include <FL/fl_draw.H>
#include <FL/Fl_Box.H>
class TestRect : public Fl_Box
{
public:
TestRect( int X, int Y, int W, int H ) : Fl_Box( FL_UP_BOX, X, Y, W, H,
"" ) {
align(FL_ALIGN_CENTER);
color( FL_RED );
}
};
#endif
thanks for further assistance :(
testalucida
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk