Good afternoon.
I hope someone help me.
I am working with GUI--> MessageBox
How can i show a short message on the screen, with the reply or the button you clicked as a message?
What can i do with the variable "_answer".
Thank you for reading.
predicates
onMensajesMessagebox1 : window::menuItemListener.
clauses
onMensajesMessagebox1(_Source, _MenuTag) :-
_answer = messageBox("Message Title", "This is a Message", 3, 2, 1, 0).
%What Next
-
- VIP Member
- Posts: 458
- Joined: 5 Nov 2000 0:01
Re: To show a message with MessageBox
The return value is the button number (1...N) you clicked. You may use it to control subsequent program flow:
In this case, pressing the [Esc] key or closing the dialog by clicking the title bar [X] returns '2'. You can omit the vpiDomains:: qualification if vpiDomains is listed in the open statement of the .pro file.
It is better code style to use the mesbox_XXX constants rather than the integers so you can easy see what your intent was for the code after a month or two.
Code: Select all
ButtonNumClicked =
vpiCommonDialogs::messageBox("Message Title", "This is a Message", vpiDomains::mesbox_iconError,
vpiDomains::mesbox_buttonsokcancel, vpiDomains::mesbox_defaultfirst,
vpiDomains::mesbox_suspendapplication),
stdio::write("\n You clicked button "),
if ButtonNumClicked = 1 then
stdio::write("[OK]")
else
stdio::write("[Cancel]")
end if.
It is better code style to use the mesbox_XXX constants rather than the integers so you can easy see what your intent was for the code after a month or two.
