> Fabio Bracci wrote:
>
> > a) why is draw() a protected method?
>
> Because normally the user should not call draw the widgets explicitly,
> it is drawn when needed within Fl::flush() - ie within Fl::run() loop.
>
> HOWEVER draw() of Fl_Widget is public!
> So there is nothing to stop you to downcast and access it anyway - like
>
>    ((Fl_Widget *)my_group)->draw();
>
> > b) how to trigger draw()? I'm thinking of a group->hide(); group->show() 
> > sequence, but it seems clumsy to me ...
>
> You can trigger it by
>
>    my_group->redraw();
>
> but there is even better way as above call may make dirty also
> particular screen window regions which would need to be redrawn with
> next call to Fl::flush() within UI loop. To avoid that, it is better and
> faster to only set damage flags using
> Fl_Widget::clear_damage(FL_DAMAGE_ALL) call. But we need to assure that
> at that moment the screen up-to-date and we do not interfere wit the UI
> updating loop - so we will call Fl::flush() first. Aftrer drawing we can
> safely clean the the damage flags back. So the code sequence would be:
>
>   Fl::flush(); // now everything should be clean
>                // and screen is up-to-date
>
>   my_group->clear_damage(FL_DAMAGE_ALL); // makes it dirty
>                     // without destroying regions
>
>   ((Fl_Widget *)my_group)->draw(); // now it should draw just fine
>
>   my_group->clear_damage(0); // makes it clean again
>
>
> Roman

Hi,
this indeed worked, forgetting the clear_damage call the system simply crashes 
...


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

Reply via email to