>
> > So how come you can't just write a stand alone function, providing the
> > headers are there:
> >=20
> > void draw() {
> >=20
> > fl_color(FL_BLACK);
> > fl_rectf(20,20,20,20);
> > }
>
>
> You mean as a "stand alone" function, not a member of any class?
> You can, but then how will it be called?
>
> If you create a standalone function like that, then call it from within
> the draw() method of your class, it will duly draw your rectangle.
>
> However, if you just try to call it randomly at some point in your code,
> you have no way of knowing what rendering context might be valid at that
> time, so where will the drawing go?
>
> The only valid place to do *any* drawing in fltk is within the draw()
> method of a widget class, but if you want to create a function that does
> all the drawing, then call that from the draw() method, that'll be just
> fine.
I think am kind of getting this.. the idea is derive a class from fl widget, so
then my own class which say calls an fl_box into being
can then use the box as it's 'drawing canvas' by calling the inherited
draw function from the widget class.
Whenever i wanted to draw the rectangle i could just call
myClass.draw(x,y,w,h) ??
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk