1
1
Fork 0
mirror of https://github.com/FellippeHeitor/InForm.git synced 2024-09-16 19:03:54 +00:00

Created MessageBox Function (markdown)

Fellippe Heitor 2019-04-20 20:26:48 -03:00
parent 5a6325f4a2
commit 45f658697c

22
MessageBox-Function.md Normal file

@ -0,0 +1,22 @@
Displays a message to the user and returns a value indicating the button that was clicked.
FUNCTION MessageBox& (Message$, Title$, Setup AS LONG)
Not specifying Title$ will have the message box inherit the main form's title/caption.
Setup is a combination (button + icon) of:
* Buttons, which can be `MsgBox_OkOnly, MsgBox_OkCancel, MsgBox_AbortRetryIgnore, MsgBox_YesNoCancel, MsgBox_YesNo, MsgBox_RetryCancel, MsgBox_CancelTryagainContinue, MsgBox_CancelTryagainContinue`.
* Icons, which can be `MsgBox_Critical, MsgBox_Question, MsgBox_Exclamation, MsgBox_Information`
The possible return values are: `MsgBox_Ok, MsgBox_Cancel, MsgBox_Abort, MsgBox_Retry, MsgBox_Ignore, MsgBox_Yes, MsgBox_No, MsgBox_Tryagain, MsgBox_Continue`.
All combinations of the above work as expected in Windows. For macOS and Linux, you only get OkOnly and YesNo for buttons.
Sample usage:
Answer = MessageBox("Do you love QB64?", "", MsgBox_YesNo + MsgBox_Question)
IF Answer = MsgBox_No THEN
Caption(Label1) = "I'll give you some more time to fall in love."
ELSE
Caption(Label1) = "We do too!"
END IF