I am surprised your sample code even works. The MessageBox can only return one value the way you have it set up. If you are checking a return code from MessageBox you should have the fourth parameter as YesNo!, YesNoCancel!
I think whoever did this does not know what they are doing, it makes no sense at all there are zero options in this logic.
Do you want it to be a question where the user can respond? If so then do something like:
integer li_rc
li_rc = Messagebox("Confirm your intentions","Do you want to close the tab?",Question!,YesNo!,2)
if li_rc = 1 then
// user clicked YES because it is the first option of YesNo!
else
// user clicked NO because it is the second option of YesNo!
end if
fyi: the last argument is the default button if the user presses enter
The window has closequery event which fires when it is closing, you can perform processing in that event to cause the window to NOT close. I don't know if the tab has anything like this but you could probably fix this question, and then disallow the close. If you just want to tell the user something then just do MessageBox("Message Subject", "Message Body", Exclamation!) there is no need to use OK! which is the default
Here is an idea:
Look in the clicked event of the tab control. There is probably code there that is closing the tab. You could put additional logic to check permissions and bypass the closing logic. Or you could set the ShowPicture property to false if the user is not able to close, or maybe show a different pic, of a disabled looking X.