On 19.05.2010, at 10:22, Lakshmi wrote:
> Thanks for that detailed explanation :)..I had gotten really confused with
> the concepts...
>
> What I'm doing now is I'm not creating subwindows, but instead I'm creating
> windows outside the begin(); - end(); of the main window. I was almost able
> to achieve all the requirements, but I'm facing one problem.
This is FLTK 2 code, and I can only guess, but maybe this can
help. Either don't make the windows non-modal, or use the FLTK 2
child_of() method to achieve what you want.
> A sample of my code is as below :
most of the code snipped...
> int main(int argc, char ** argv) {
>
> fltk::Window* main_data_window = new fltk::Window(15,100,400, 400,
> "Sample App");
> main_data_window->buttonbox(fltk::BORDER_BOX);
> main_data_window->color((fltk::Color)56);
> main_data_window->align(fltk::ALIGN_LEFT|fltk::ALIGN_CLIP);
> main_data_window->begin();
> main_data_window->hide();
hiding the window is not necessary here.
> main_data_window->end();
>
> Sample_Window* compass_window = new Sample_Window(16,125,250,200,1);
> compass_window->border(0);
> compass_window->align(fltk::ALIGN_TOP|fltk::ALIGN_LEFT);
> compass_window->set_non_modal();
> compass_window->hide();
see above
> compass_window->end();
>
> Sample_Window* ack_window = new Sample_Window(16,325,250,50,2);
> ack_window->border(0);
> ack_window->align(fltk::ALIGN_TOP|fltk::ALIGN_LEFT);
> ack_window->set_non_modal();
> ack_window->hide();
see above
> ack_window->end();
The following lines establish a window hierarchy. You can probably
work against it by adding one line (see below):
> main_data_window->show();
> compass_window->show();
ack_window->child_of(main_data_window); // make it "child of" the
main window
Note: I'm not a FLTK 2 user, and maybe the syntax is wrong.
> ack_window->show();
>
> compass_window->hide(); //if these two lines are commented, then both
> the windows are visible,
> compass_window->show();// but if they are executed, only compass_window
> will be visible
>
> return fltk::run();
> }
>
>
> Depending on the user, I need to hide or show compass_window or
> ack_window..but when I call show(), other windows whose's child_of_ is the
> window I'm gonna show, also disappear..Is there any way I can overcome this??
If the above doesn't help, then you can hide both windows and then
show the one you want, because this will (probably) create the correct
window hierarchy again, but I'm not at all sure about this, because
there might still be the child_of() relation. You may need to reset
it or make it explicit, as suggested above.
HTH,
Albrecht
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk