0

I made a pop-up window for my application which is called ApplicationManager. It's a simple input dialog box which waits for user input for 10 secs. If no value entered, the pop-up closes. I already got this part working. Now I am struggling with the simpler part. When any data is entered in the input and OK is pressed, the dialog is supposed to close again. But at this->hide() in handleCallthe GUI just hangs, even though the code proceeds further.

class Popup : public Fl_Window {
private:

Fl_Input *input;
Fl_Button *okBtn;
Fl_Button *cancelBtn;

std::string barcode;

void handleCall(Fl_Widget* w) {
    Fl_Button *b = (Fl_Button*)w;
    if(b->label() == "OK") {
        barcode = input->value();
    }
    std::cout << b->label() << " " << input->value() << std::endl;
    this->hide();
}

static void callBk(Fl_Widget* w, void* p){
    Popup *pop = (Popup*)p;
    pop->handleCall(w);
}

public:

Popup() : Fl_Window(400,120, "Manual Barcode") {
    Fl_Input *label = new Fl_Input(250, 25, 0, 0, "Enter Barcode Manually");
    input = new Fl_Input(75, 45, 300, 25);
    okBtn = new Fl_Button(235, 85, 50, 25, "OK");

    okBtn->callback((Fl_Callback*)callBk, this);
    cancelBtn = new Fl_Button(300, 85, 75, 25, "Cancel");
    cancelBtn->callback((Fl_Callback*)callBk, this);
    end();

    barcode = "";
}

void pop() {
    std::cout << "showing popup" << std::endl;
    //Fl::add_timeout(12, hidePopup, (void*)this);
    this->show();
}
};
harsh
  • 905
  • 1
  • 10
  • 21
  • I've just tried out your code. It doesn't hang - it just completes. Which compiler/platfrom are you running this on? It doesn't hang on windows7/VS2010express. – cup Jan 09 '14 at 12:16
  • Actually this is a small part of a larger code. I was unable to recreate the same problem in a test scenario. I changed the structure of my code a bit and now it works fine :-) – harsh Jan 10 '14 at 07:35

0 Answers0