[gtkmm] Overloading on_response() member of a Dialog object.



I would like to create a dialog box with an Apply button in the "action
area section" of the dialog. I have binded the ID value of 0 to the
Apply button so I can detect between an Apply, Cancel or Validate button
click.

Now I wish to do some processing in the dialog box when the Apply button
is pushed. I have linked the clicked event of the button to the
appropriate function handler.

Since I don't want to close the dialog box if the apply button is
pushed, I have overloaded the on_response function of a dialog object,
and decides to call the response() member only for the Cancel and
Validate button. The Validate button would not send any signals to the
caller of the dialog.run()

After some debugging I figured-out that my overloaded function of
on_resume() is properly called. However, my overloaded function has been
called, the response() member is called again by some other code. This
causes a run time error since the run() call already exited by my call
to response(). When the second response() is called, my application
crashes.

Now Since this extra code calls response(), it cause the click of my
validate button to exit the dialog box.

Does anybody knows what is happening here?

It is possible to have a button in the "action area" that does not cause
the dialog to close?

For information, I am using gtkmm 2.0.0. I also looked the code of gtkmm
for the dialog object, and it seems ok for me. But since I am quite new
to GTK and gtkmm I rather ask the community for my special way of using
a dialog box.

Maybe I am doing a bad design decision by using a dialog object that
way. If it is the case, please let me know, I would probably use a
window object instead. But then I loose the nice way of calling run()
and retrieving the ID of what button was clicked.

-- 
Jean-Luc Bedwani <jlbedwani imascope ca>
Imascope Inc.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]