On 20/02/11 11:18, testalucida wrote:

> I got a problem with "simultaneous" drawing two different areas and
 > can't find a clue how to come along with.



> The app consists of a class hierarchy like so:
>
> Fl_Double_Window
>       Group (derived from Fl_Group)
>               Bar (derived from Fl_Widget)
>               Scroll (derived from Fl_Scroll)
>                       Canvas (derived from Fl_Group)
>
> As you can see Canvas is to be scrolled within the containing Scroll
> class. Canvas contains vertical lines. Each time the draw() method of
> Canvas is called the lines are drawn. No problem so far.
>
> The x position of each drawn line is to be displayed by the Bar
> class. It's positioned above the Scroll widget. And this is what
> doesn't work: although the draw-method of Bar is called, no drawing
> happens. Only on resizing the window the last x position is drawn. I
> guess my handling of damage and/or redraw is wrong, but I can't
> figure out how to do it right. Can you help? The code is shown
> below.

I'm not sure, as I can't quite see what you are trying to do, but here 
goes anyway - I tweaked the code to make it compile, so may have 
"broken" it even more in doing so!

It looks to me as if your "Bar" class, although defined higher up in the 
hierarchy than the "Canvas" class, is only ever drawn if the "Canvas" 
class is drawn, or if the enclosing parent "Group" is drawn.

As can be seen from the output diagnostics already in your code, moving 
the "Scroll" does not cause the "Canvas" to be drawn, and hence does not 
cause the "Bar" to be updated.

Resizing the window causes "Group" to be drawn, and hence all its 
children, leading to the "Canvas" being re-drawn and then finally the 
"Bar" gets drawn, with the correct text.

So, I think that the issue is simply that moving the "Scroll" does not 
actually change the "Canvas" or the "Bar" at all, and hence the "Bar" is 
not drawn.

You can probably update the "Bar" from the "Scroll" class instead and 
see if that works any better.







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

Reply via email to