Hello Guest it is April 17, 2021, 07:12:38 AM

Author Topic: message box with yes or no  (Read 197 times)

0 Members and 1 Guest are viewing this topic.

Offline Bill_O

*
  •  362 362
    • View Profile
message box with yes or no
« on: August 11, 2020, 10:57:50 AM »
I found some old threads about different message boxes.
I could use one with a yes or no option.
When I did any option for the message box it gave me an error.
Why is this code not working?

Code: [Select]
--------------------------------------
--test
---------------------------------------
function Test()
inst = mc.mcGetInstance()
rc = wx.wxMessageBox("Testing yes no box",2)
if (rc == 2) then
wx.wxMessageBox("Yes was pressed")
elseif (rc == 8) then
wx.wxMessageBox("No was pressed")
else
wx.wxMessageBox("Did not work")
end
end
---------------------------------------------------------------


Thanks,
Bill
Re: message box with yes or no
« Reply #1 on: August 11, 2020, 11:50:56 AM »
Hi Bill,

Try

Code: [Select]
rc = wx.wxMessageBox("Message", "Title of box", wx.wxYES_NO)
if (rc == wx.wxYES) then
--yes was pressed
elseif  (rc == wx.wxNO) then
--no was pressed
end
« Last Edit: August 11, 2020, 11:53:29 AM by SwiftyJ »

Offline Bill_O

*
  •  362 362
    • View Profile
Re: message box with yes or no
« Reply #2 on: August 11, 2020, 12:20:13 PM »
Swifty,

Worked great.
I had tried some code similar to what you showed but was missing a few little things.
Thanks for the help.

Bill