On 05/13/12 18:17, Eugenio Bargiacchi wrote:
> I've made within my main window a Fl_Scroll.
>
> Inside it there is a Fl_Group, which has two Fl_Input and a Fl_Pack.
>
> Inside of the Fl_Pack there is a Fl_Button, which, if pressed, adds a
> Fl_Input within the Fl_Pack and increases the size of the Fl_Group to house
> the increased Fl_Pack.
>
> Fl_Window
> '-- Fl_Scroll ( Vertical )
> '-- Fl_Group
> +-- Fl_Input 1
> +-- Fl_Input 2
> '-- Fl_Pack ( Vertical )
> '-- Fl_Button ( adds Fl_Inputs to Fl_Pack )
>
> However, if the height of the Fl_Group exceeds the height of the Fl_Scroll
> and I try to scroll down to see the added fields, the Fl_Scrolls fails to
> render them.
>
> This happens as soon as the Fl_Scroll is scrolled. If I resize the Window so
> that its new size is bigger than the Fl_Group, it is rendered correctly, but
> as soon as I add more inputs and I try to scroll down, nothing is rendered.
>
> Am I doing something wrong or is this a bug? If the latter, is there a
> workaround?
Might need to see your code as a reduced *compilable* example
(like the below).
Fl_Scroll is a group already, so perhaps there's no need for
the extra Fl_Group, and therefore can avoid having to 'grow' it
when the pack enlarges.
So for instance, if I remove the extra group, I end up with:
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Scroll.H>
#include <FL/Fl_Input.H>
#include <FL/Fl_Pack.H>
#include <FL/Fl_Button.H>
void Add_CB(Fl_Widget *w, void *data) {
Fl_Pack *pak = (Fl_Pack*)data;
pak->begin();
new Fl_Input(10,0,200,25);
pak->end();
pak->window()->redraw();
}
int main() {
Fl_Window *win = new Fl_Window(400,300);
Fl_Scroll *scr = new Fl_Scroll(10,10,400-20,300-20);
Fl_Input *in1 = new Fl_Input(140,20,200,25,"Input 1");
Fl_Input *in2 = new Fl_Input(140,55,200,25,"Input 2");
Fl_Button *but = new Fl_Button(140,90,100,25,"Add..");
Fl_Pack *pak = new Fl_Pack(10,135,400-40,10,"Pack");
pak->end();
pak->type(Fl_Pack::VERTICAL);
pak->box(FL_DOWN_FRAME);
but->callback(Add_CB, (void*)pak);
win->end();
win->resizable(scr);
win->show();
return(Fl::run());
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk