I've got it:
Instead of
fl_rect( 20, 20, 100, 100, FL_RED );
I have to write
fl_rect( x()+20, y()+20, 100, 100, FL_RED );
then it works
sorry about the confusion ;)
bye
testalucida
> Hi all,
>
> I created a class "TaskDrawingPanel" which is inherited from Fl_Widget and
> put it into a Fl_Scroll instance, which in turn is a child of my main window.
>
> The draw method of TaskDrawingPanel does nothing else then drawing the red
> outline of a rectangle.
> My Problem: when scrolling the rectangle out of sight and then scrolling back
> it isn't redrawn properly.
>
> The main method looks like so:
>
> int main(int argc, char **argv) {
> Fl_Double_Window mainWin( 50, 50, 400, 400, "TaskOrganiser" );
> mainWin.box( FL_NO_BOX );
> Fl_Scroll scroll( 0, 0, 400, 400, "" );
> scroll.type( Fl_Scroll::BOTH );
> TaskDrawingPanel panel( 0,0, 500, 500, "Panel" );
> scroll.end();
>
> mainWin.resizable( scroll );
> mainWin.show( argc, argv );
> return Fl::run();
> }
>
> And that's the TaskDrawingPanel class:
>
> class TaskDrawingPanel : public Fl_Widget
> {
> void draw() {
> draw_box();
> fl_rect( 20, 20, 100, 100, FL_RED );
> }
>
> public:
> TaskDrawingPanel(int X,int Y,int W,int H,const char* L) :
> Fl_Widget(X,Y,W,H,L)
> {
> align(FL_ALIGN_TOP);
> box(FL_FLAT_BOX);
> color(FL_WHITE);
> }
> virtual ~TaskDrawingPanel() {}
>
> protected:
> private:
> };
>
> Does anybody see what I'm doing wrong?
> Any hints appreciated!
>
> Thanks and bye
> testalucida
>
>
>
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev