On 03/18/13 08:00, memoryl...@tin.it wrote:
> Hi all,
> forgive me but here is another question, not-so-evident for me.
> 
> You have to realize a blinking message, or an object which periodically swaps 
> two images :
> think of an alarm icon.
> The alarm is sounding, and the icon keeps alternating red/yellow horn images 
> until the user pushes the ack button.
> 
> Use a timer to blink... but things are not always "smooth blinking".
> Not a big problem, anyway... just would like to know if there is a clever way 
> to assure a smooth blinking
> (usually we are speaking of small objects).

        Make sure the window is an Fl_Double_Window, so that it uses 
double-buffering.

        Beyond that, just have the timer callback:

                1) Change the the thing being blinked to "on" or "off" 
(hide()/show() can work)

                2) Call redraw() on the widget that handles the background of 
the widget in question.

                   If the widget draws its own background, then tell /it/ to 
redraw. If the widget
                   is 'see through' (eg. text label with FL_NO_BOX), then tell 
the closest parent
                   that handles the background to redraw()
                   or call redraw() on the parent that draws the background 
under the widget

                3) Call Fl::repeat_timeout() to reset the timer for the next 
trigger

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

Reply via email to