View Full Version : Confirmation Message Box -- how to use it in an elegant way inside a function?

18 Nov 2010, 1:20 AM

I'm trying to use a message box in an appropriate way inside a function. My problem is that I need
the resulting answer - whether user clicked yes or no inside that function.
Here is some pseudocode of what I intend to do:

// some calculations
answer = getAnswerAndShowYESNOMessageBox
var x;
x = 1;
x = 2;
// finish calculations using x

I can easily display the box and get into the if(answer=='yes') block, but I have no ideo of how to return
the clicked state of the message box into a variable while staying in that function and waiting until user has clicked.
I could probably split my function into several parts which are called accordingly, but is there a more elegant way without splitting?

Thanks for your ideas,