Greg Ercolano wrote:
> zlc53 wrote:
>> i use postion function , but can't auto redraw
> 
>       That's pretty terse, but I'm guessing you're trying to

You must be reading minds, I wouldn't have known what to guess here ;-)

>       re-position a widget with w->position(x,y), but the widget
>       is not redrawing or not redrawing correctly.
> 
>       When you move a widget, you have to tell the parent group
>       the child was moved by calling init_sizes(), eg:
>       
> http://fltk.org/doc-2.0/html/classfltk_1_1Group.html#dde626fecc1b50fa9f8d7f8a23fcff49
> 
>       If you are having trouble with the change not redrawing
>       correctly, you may also need to call the parent widget's
>       redraw() function. So in all:
> 
>               w->position(newx, newy);
>               w->parent()->init_sizes();      // or specify the parent group, 
> eg. group->init_sizes()
>               w->window()->redraw();

I'd add that the last line _can_ be too much (redrawing the whole window might 
flicker), it would better read

                w->parent()->redraw();          // redraw parent group only

That said, I seem to remember that in FLTK2 there's a statement that FLTK2 does 
all the needed redrawing by itself, so that calling redraw should _not_ be 
necessary, but I could be completely wrong with this (no FLTK2 experience).

Albrecht

P.S.: zlc53, please post your questions in fltk.general, fltk.development is 
intended for development of fltk itself. Thanks.
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to