0

I have a program that displays an input window and is then supposed to close the input window and open another window using the data from the input window. The problem I am facing is that clicking the submit button on the input window terminates the program.

int main() {
    int month;
    int year;
    String file_name;
    cin>>file_name;
    Input_window win(Point(100,200),600,300,"Calendar");
    win.show();
    Calendar win1(Point(100,100),750,800,"Canvas",year,month,file_name);
    return gui_main();
}

I've looked thorugh Stroustrup's Principle and Practice Using C++ and through the documentation for FLTK but I have been unable to find a solution.

Here is the code for the button click:

void Input_window::cb_quit(Address,Address pw)
{
reference_to<Input_window>(pw).save_input();
}

void Input_window::save_input()
{
month = box_month.get_int();
year = box_year.get_int();

redraw();
}
Robotguy27
  • 25
  • 5
  • 7
    Well you _do_ `return` from your `main` function in the middle. – Some programmer dude Apr 27 '13 at 17:06
  • You need to show the code the handles the button click. – Captain Obvlious Apr 27 '13 at 17:25
  • There's no chance anyone without the *entire* program source will be able to help you. If your program is large, then there's no chance at all. You need to learn how to use a debugger. – n. m. could be an AI Apr 27 '13 at 18:19
  • In general in fltk it is advisable to use 'hide()' to hide a window. If the window is the last one the program will terminate. So a solution could be open the second window before hiding the first one. For a more correct answer you will have to show some code.. – hdrz Jan 19 '15 at 18:03

0 Answers0