> Jos Dreesen wrote:
> > This works, i get a more or less usable display.
> > But at the expected cost of some flicker.
>
>       As Ian mentioned, use an Fl_Double_Window instead of
>       Fl_Window. That should prevent seeing drawing operations
>       as they run.

The flickering was caused by me calling the draw directly, instead of just 
setting the damage bits. (A timer called the redraw 10 times a second).
>
> >>    Or, don't do that and just make sure the widget you're deriving
> >>    from has a solid box() type type of some kind, likebox(FL_FLAT_BOX).
> >>    This way when the widget redraws, it won't leave the old image behind.
> >
> > This does not work.
>
>       Hmm, would have to see your code to know why that doesn't work.
>       Maybe your draw() function isn't calling the underlying widget's
>       draw() first, short circuiting the widget's ability to draw itself.

This was indeed the case. Thanks, this now works OK ( new to FLTK...)

My redraw routine is now as follows :
----------------------------------------------------------
 void draw() {
    int x, dmg;
   dmg=damage();

  if (dmg & DmgDsp) /* update Lilith display, redraws Fl_Bitmap */
      { Fl_Box::color(BackCol);
        Fl_Box::draw();                   /* redraw background */
        fl_color(FrontCol);
        ldsp-> draw(border, border+border/2); /* redraw bitmap */
           }
    if (dmg & DmgGui) /* redraw ornamental boxes */
      { x=DspSplit+10;
        fl_color(FL_BLUE);
        if (SimDspBrdr)
        { dbox(" Lilith display ",border/2,      border,  480, 
LilDspWidth+border, LilDspHeight+border );
          dbox(" Disk ",        x-border/2, yd-border/2,   20, 312,  80 );  /*  
disk    box */
          dbox(" Speed ",       x-border/2, ys-border/2,   20, 312,  42 );  /*  
speed  box */
          dbox(" Message box ", x-border/2, yt-border/2,   20, 312, 
TxtBoxH+border );  /* message  box */
         }
      logo-> draw(DspSplit, border/2);
      }
  }
-----------------------------------------------------------------

One last question : is there a better way the handle the colors as just setting 
background and foreground them each time I redraw the "ldsp" bitmap ? ( the 
colors can switch between blackonwhite and whiteblack )

                                       Jos








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

Reply via email to