[EMAIL PROTECTED] wrote:
> Albrecht Schlosser wrote:
>> You should take the box's border into account. You can use
>
> I know that, but as I said before, all I want is keeping the
> main window's borders visible whatever the size or the position
> of the child widget inside the parent widget (main window).
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());
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk