Re: [fltk.general] Displaying different windows with button callbacks
Yes that works and about what I was looking for. Thanks. I made some modifications, I changed the button to box. And how can I input stuff in it correctly? Say I wanna place an output box in it. kw1 = new Fl_Output(55, 60, 180, 100); I tried this but that didn't work: Fl_Box* w2 = new Fl_Box(48, 48, 204, 212, B); w2-labelsize(148); kw1 = new Fl_Output(55, 60, 180, 100); w2-hide(); panel[1] = w2; ___ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk
Re: [fltk.general] Displaying different windows with button callbacks
On 04/27/12 08:27, fltkCoder wrote: Hi, How can I produce the same result I would with tabs, showing different main windows each time you click on one, with a button callback? Sounds like Fl_Wizard (push Next button to see next page), e.g. http://seriss.com/people/erco/fltk/#Fl_Wizard But if you really want to roll your own, it's easy; make a window, and put two (or more) overlapping Fl_Groups inside it. Put the different widgets in each group, treating the groups as separate 'pages'. show() only one of the groups and keep the others hidden with hide(). To flip pages, just show() the one you want and hide() the others. Pretty much exactly what Fl_Wizard does, I think. ___ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk
Re: [fltk.general] Displaying different windows with button callbacks
On 27.04.2012, at 17:26, fltkCoder wrote: Hi, How can I produce the same result I would with tabs, showing different main windows each time you click on one, with a button callback? Do you mean Fl_Wizard? I don't really understand your question. ___ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk
Re: [fltk.general] Displaying different windows with button callbacks
Is there a full code example of this? It doesn't sound easy to implement it. ___ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk
Re: [fltk.general] Displaying different windows with button callbacks
No it doesn't jump pages. Its supposed to be one set part of buttons that always remain. Once you click on a button it will display a different window in the middle let's say. ___ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk
Re: [fltk.general] Displaying different windows with button callbacks
On 27.04.2012, at 19:44, fltkCoder wrote: Is there a full code example of this? It doesn't sound easy to implement it. Yes, fltk-1.3.0/test/tabs.cxx It's simple. Just create multiple children and a next/previous button. FLTK does the rest. ___ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk
Re: [fltk.general] Displaying different windows with button callbacks
On 27.04.2012, at 19:48, fltkCoder wrote: No it doesn't jump pages. Its supposed to be one set part of buttons that always remain. Once you click on a button it will display a different window in the middle let's say. Do you mean Fl_Tabs? Or you could put an Fl_Wizard next to an Fl_Browser? Do you have a screen shot or drawing of what you are trying to do? ___ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk
Re: [fltk.general] Displaying different windows with button callbacks
On 27.04.2012, at 21:22, fltkCoder wrote: Yes but the tabs are connected to the window. And the wizard just jumps windows. Here is an example of what I mean. http://i1071.photobucket.com/albums/u511/fltkCoder/window.png Like this? Open ___ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk
Re: [fltk.general] Displaying different windows with button callbacks
On 27.04.2012, at 21:51, Matthias Melcher wrote: On 27.04.2012, at 21:22, fltkCoder wrote: Yes but the tabs are connected to the window. And the wizard just jumps windows. Here is an example of what I mean. http://i1071.photobucket.com/albums/u511/fltkCoder/window.png Like this? Open Accidentally clicked Send ;-) test.fl - use Fluid to open and generate c++ code: # data file for the Fltk User Interface Designer (fluid) version 1.0300 header_name {.h} code_name {.cxx} Function {make_window()} {open } { Fl_Window {} {open xywh {499 241 499 482} type Double visible } { Fl_Wizard myWizard {open xywh {24 24 256 271} box UP_BOX } { Fl_Button {} { label A xywh {44 48 204 212} labelsize 148 } Fl_Button {} { label B xywh {48 48 204 212} labelsize 148 hide } Fl_Button {} { label C xywh {48 52 204 212} labelsize 148 hide } Fl_Button {} { label D xywh {44 52 204 212} labelsize 148 hide } } Fl_Button {} { label A callback {myWizard-value(0);} xywh {320 28 63 20} } Fl_Button {} { label B callback {myWizard-value(1);} xywh {324 84 63 20} } Fl_Button {} { label C callback {myWizard-value(2);} xywh {328 148 63 20} } Fl_Button {} { label D callback {myWizard-value(3);} xywh {328 204 63 20} } } } Function {main(int argc, char **argv)} {open selected return_type int } { code {Fl_Window *win = make_window(); win-show(argc, argv); Fl::run();} {} } --- test.h // generated by Fast Light User Interface Designer (fluid) version 1.0300 #ifndef test_h #define test_h #include FL/Fl.H #include FL/Fl_Double_Window.H #include FL/Fl_Wizard.H extern Fl_Wizard *myWizard; #include FL/Fl_Button.H Fl_Double_Window* make_window(); int main(int argc, char **argv); #endif --- test.cxx // generated by Fast Light User Interface Designer (fluid) version 1.0300 #include test.h Fl_Wizard *myWizard=(Fl_Wizard *)0; static void cb_A(Fl_Button*, void*) { myWizard-value(0); } static void cb_B(Fl_Button*, void*) { myWizard-value(1); } static void cb_C(Fl_Button*, void*) { myWizard-value(2); } static void cb_D(Fl_Button*, void*) { myWizard-value(3); } Fl_Double_Window* make_window() { Fl_Double_Window* w; { Fl_Double_Window* o = new Fl_Double_Window(499, 482); w = o; { myWizard = new Fl_Wizard(24, 24, 256, 271); myWizard-box(FL_UP_BOX); { Fl_Button* o = new Fl_Button(44, 48, 204, 212, A); o-labelsize(148); } // Fl_Button* o { Fl_Button* o = new Fl_Button(48, 48, 204, 212, B); o-labelsize(148); o-hide(); } // Fl_Button* o { Fl_Button* o = new Fl_Button(48, 52, 204, 212, C); o-labelsize(148); o-hide(); } // Fl_Button* o { Fl_Button* o = new Fl_Button(44, 52, 204, 212, D); o-labelsize(148); o-hide(); } // Fl_Button* o myWizard-end(); } // Fl_Wizard* myWizard { Fl_Button* o = new Fl_Button(320, 28, 63, 20, A); o-callback((Fl_Callback*)cb_A); } // Fl_Button* o { Fl_Button* o = new Fl_Button(324, 84, 63, 20, B); o-callback((Fl_Callback*)cb_B); } // Fl_Button* o { Fl_Button* o = new Fl_Button(328, 148, 63, 20, C); o-callback((Fl_Callback*)cb_C); } // Fl_Button* o { Fl_Button* o = new Fl_Button(328, 204, 63, 20, D); o-callback((Fl_Callback*)cb_D); } // Fl_Button* o o-end(); } // Fl_Double_Window* o return w; } int main(int argc, char **argv) { Fl_Window *win = make_window(); win-show(argc, argv); Fl::run(); } ___ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk
Re: [fltk.general] Displaying different windows with button callbacks
Well it doesn't compile. The cb_B are causing problems. ___ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk
Re: [fltk.general] Displaying different windows with button callbacks
On 27 Apr 2012, at 21:47, fltkCoder wrote: Well it doesn't compile. The cb_B are causing problems. Yeah, I think what Matt meant was more like this... Trivial mod applied... #include FL/Fl.H #include FL/Fl_Double_Window.H #include FL/Fl_Wizard.H #include FL/Fl_Button.H Fl_Double_Window* make_window(); Fl_Wizard *myWizard=(Fl_Wizard *)0; Fl_Button *panes[4]; static void cb_A(Fl_Button*, void*) { myWizard-value(panes[0]); } static void cb_B(Fl_Button*, void*) { myWizard-value(panes[1]); } static void cb_C(Fl_Button*, void*) { myWizard-value(panes[2]); } static void cb_D(Fl_Button*, void*) { myWizard-value(panes[3]); } Fl_Double_Window* make_window() { Fl_Double_Window* w; { Fl_Double_Window* o = new Fl_Double_Window(499, 482); w = o; { myWizard = new Fl_Wizard(24, 24, 256, 271); myWizard-box(FL_UP_BOX); { Fl_Button* o = new Fl_Button(44, 48, 204, 212, A); o-labelsize(148); panes[0] = o; } // Fl_Button* o { Fl_Button* o = new Fl_Button(48, 48, 204, 212, B); o-labelsize(148); o-hide(); panes[1] = o; } // Fl_Button* o { Fl_Button* o = new Fl_Button(48, 52, 204, 212, C); o-labelsize(148); o-hide(); panes[2] = o; } // Fl_Button* o { Fl_Button* o = new Fl_Button(44, 52, 204, 212, D); o-labelsize(148); o-hide(); panes[3] = o; } // Fl_Button* o myWizard-end(); } // Fl_Wizard* myWizard { Fl_Button* o = new Fl_Button(320, 28, 63, 20, A); o-callback((Fl_Callback*)cb_A); } // Fl_Button* o { Fl_Button* o = new Fl_Button(324, 84, 63, 20, B); o-callback((Fl_Callback*)cb_B); } // Fl_Button* o { Fl_Button* o = new Fl_Button(328, 148, 63, 20, C); o-callback((Fl_Callback*)cb_C); } // Fl_Button* o { Fl_Button* o = new Fl_Button(328, 204, 63, 20, D); o-callback((Fl_Callback*)cb_D); } // Fl_Button* o o-end(); } // Fl_Double_Window* o return w; } int main(int argc, char **argv) { Fl_Window *win = make_window(); win-show(argc, argv); Fl::run(); } ___ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk