Hello Guest it is April 15, 2024, 11:57:30 PM

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

0 Members and 1 Guest are viewing this topic.

Offline Bill_O

*
  •  563 563
    • 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

*
  •  563 563
    • 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