> In what sense are these "global"? If you "new" a widget *of any sort*
> it will be automatically added to the last valid window, so if this is
> literally what your code looks like you are probably creating a series
> of nested windows, which is *not* going to be what you want.
I want to have all of my menu windows "inside" of the main window. I don't want
to have each menu window appearing in the taskbar and I don't really need the
whole window decoration (max./min./close buttons).
> you *must* end the previous window before "new"ing the next
> one... Viz:
As I mentioned, each of my subwindows is created as an object of a specific
class. The class constructor calls the "end()" method after adding all the
widgets.
The only window without an "end()" call was MainWin. I've now rewritten the
code to look like this:
// Globals
Fl_Double_Window* MainWin;
FwdKinematics* FKMenu;
FKMenuDH* FKPopDH;
..
FLGLWindow* GL_MainWin;
// Definition (inside main)
FKMenu = new FwdKinematics((int)(ScreenWidth*.12),
(int)(ScreenHeight*.12));
FKPopDH = new FKMenuDH(0,0);
...
GL_MainWin = new FLGLWindow(0, 20, ScreenWidth-6, ScreenHeight-44,
"Robotic Simulation");
MainWin = new Fl_Double_Window(2, 12, ScreenWidth-6, ScreenHeight-24,
"Robotic Simulation");
MainWin->resizable(GL_MainWin);
SetGUI(MainWin); // Call to add the menu windows and a menu bar
If I don't add the windows to MainWin, I get the proper hierarchy and event
catching (maybe done by Windoze) but when I add them to MainWin, I go back to
the same problem.
> > The first time I show a subwindow I have to use show twice...=20
> > (if it works, don't touch it!). Could that be causing the trouble?
>
> Yes.
> That should not happen.
> As a general tip, if something odd happens, try and figure out why.
> Working round it probably masks all manner of nasty little bugs...
When I leave the subwindows as top level windows, I only need to call show()
once for them to pop-up. Why do I need to do it twice when they are added to
MainWin???
> > // Unrelated:
> > Is there a method in FLTK to get the screen resolution and=20
> > fill those ScreenWidth and ScreenHeight variables?
>
> Yes.
> Fl::w() and Fl::h() will return the width and height of the current
> screen.
> If you have a multi-head setup, you probably need to look into the
> Fl::screen_count() and Fl::screen_xywh() methods.
>
Thanks! You've saved me many double-clicks to maximize my window
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk