> >> i mean for example imagine a grid of 'buttons'..
> >
> > I'd suggest using an Fl_Tile and procedurally adding
> > the buttons to that with a for() loop.
>
> Actually, the Fl_Tile isn't even necessary with the procedural
> technique; you can just add the buttons directly to the window
> (or an encompassing group), setting the positions based on the loop.
>
> The below is a simple example that makes an A-Z dialog window
> of buttons, where each button generates a callback that prints
> the button's label.
>
> You can resize the window, and all the buttons grow to follow
> its size as you'd expect.
>
> * * *
>
> #include <FL/Fl.H>
> #include <FL/Fl_Window.H>
> #include <FL/Fl_Button.H>
> //
> // Make a grid of buttons
> //
> static void Button_CB(Fl_Widget *w, void*) {
> fprintf(stderr, "You hit '%s'\n", w->label());
> }
> int main(int argc, char **argv) {
> char s[2];
> int nboxes = 0;
> Fl_Window *win = new Fl_Window(220,260, "test");
> for ( int yy=10; yy<win->h()-40; yy += 40 ) {
> for ( int xx=10; xx<win->w()-40; xx += 40 ) {
> sprintf(s, "%c", 'A'+nboxes); ++nboxes; // label for each button
> Fl_Button *but = new Fl_Button(xx,yy,40,40);
> but->copy_label(s);
> but->callback(Button_CB);
> }
> }
> win->resizable(win);
> win->end();
> win->show(argc,argv);
> return(Fl::run());
> }
Thanks for the example, i thought about leaving the tile out also, i just
thought it would make the widgets easier to handle in the design view is all
really, not for its actual functionality haha.
i really need to review the video and use of the command line thing you do, its
all so fast.
thing is this interface is part of a larger project that takes a little while
to build each time i import changed fluid header and source, as the header
changes force other files to rebuild etc.
Do you build your interface seperately while designing it then integrate it
into the target project afterwards?thus avoiding long rebuild times? Is that
what you are doing in the video? i cant remember if you had a main() file in
there or not, i cant look at it right now.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk