Greg Ercolano wrote:
>       It's a little trickier than one thinks.
>       This should work; I just added a draw() to your class
>       which handles the details.
>
> #include <FL/Fl.H>
> #include <FL/Fl_Double_Window.H>
> #include <FL/Fl_Box.H>
> #include <FL/fl_draw.H>
> class Application : public Fl_Double_Window {
>     Fl_Box *bx;                 // Child box widget
> public:
>     Application(int w, int h, const char *l, int argc, char *argv[]) : 
> Fl_Double_Window(w, h, l) {
>         box(FL_DOWN_BOX);       // Add 2 pixel border
>         color(FL_WHITE);
>
>         // Make child group to clip child box
>         begin();
>         bx = new Fl_Box(0,0,100, 400);
>         bx->box(FL_FLAT_BOX);
>         bx->color((Fl_Color) FL_RED);
>         end();
>
>         resizable(this);
>         show(argc, argv);
>     }
>     void draw() {
>         draw_box(box(),0,0,w(),h(),color());  // draw box + border
>         fl_push_clip(Fl::box_dx(box()), Fl::box_dy(box()), 
> w()-Fl::box_dw(box()), h()-Fl::box_dh(box()));
>       Fl_Group::draw_children();              // draw children inside clipped 
> region
>         fl_pop_clip();
>     }
> };
>
> int main (int argc, char ** argv) {
>    Application myApp(500, 300, "My App", argc, argv);
>    return(Fl::run());
> }

Thanks for your help Greg, it works !
I didn't know the draw_children function
and also the way the draw_box function is used.
I won't forget for the next time.

Stan wrote:
>Maybe you can say a bit more about what you're trying to accomplish.

Actually I'm trying to create a scrollbar class of my own (a subclass of 
Fl_Group).
I know, the Fl_Scroll class do that job in FLTK, but I prefer to
build mine in order to manage both scrollbar exactly the way I want to.

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

Reply via email to