When clicking YES button..
Hi,
I got message dialog displayed when the first part of the script is completed but i need to press YES button to continue to the next part of the script. When i press i press NO it should terminate the script.
The issue i'm having is when i press YES button it terminates the script and it doesn't execute the assigned function - instead it says you pressed the NO button.
Below is my intended code:
buttons = MKSet(mbYes, mbNo);
k = MessageDlg(Customers are Created !\n"+"Continue with Adding Products?", mtConfirmation, buttons, 0);
if (k==true) {
AddProduct();
Log.message("You pressed Yes");
}else{
break;
Log.message("You pressed No");
}
Any suggestions on how this code should work?.
Regards,
I don't use the built in Dialog's myself.
But, looking at the docs for it: https://support.smartbear.com/testcomplete/docs/reference/program-objects/builtin/messagedlg.html
... it says it returns a constant relating to the button that was pressed?
Your code is just checking for true or false, aka - a Boolean. Doesn't seem right to me? Try changing the post dialog check to check for the constant(s) instead .....
ie - if (k==mrYes)
(Oh yeah - and in your else, you have a "break" statement before you print the log message. Which, I presume, means it will never get to the logging line?)