Hello Guest it is April 23, 2024, 03:21:21 AM

Author Topic: Where can I find more information on wx.wxMessageBox ?  (Read 1524 times)

0 Members and 1 Guest are viewing this topic.

Offline jevs

*
  •  315 315
    • View Profile
Where can I find more information on wx.wxMessageBox ?
« on: October 20, 2019, 08:32:04 PM »
I cannot figure out what this is doing. I don't know what that 16 is on the end and I cannot find documentation for it.

This pops up a message box with a selection of "Ok" and "Cancel"

local MyChoice = wx.wxMessageBox("Click Ok to Begin Probing the New Tool","Click OK to continue" , 16)

The problem is if you pick "Cancel" it does the same thing as "Ok" and continues on with the code below it. I need cancel to end the operation. Without any info
I cannot decipher what is going on here without knowing what that 16 does. I assume it is a choice of what to do from some list that I have no idea of.....

Offline jevs

*
  •  315 315
    • View Profile
Re: Where can I find more information on wx.wxMessageBox ?
« Reply #1 on: October 20, 2019, 10:16:48 PM »
I kept digging. I never found any documentation, but I found another post on here with info that got me going..........

local rc = wx.wxMessageBox("This is my Message", "This is my Caption",16) --Ok, Cancel

--wxMessageBox Types
--2 = Yes, No
--4 = Ok
--16 = Ok, Cancel
--18 = Yes, No, Cancel

--wxMessageBox Return Values
--Yes = 2
--OK = 4
--No = 8
--Cancel = 16

It would still be nice to know where this is documented though. For now I made myself a text file with the info and put it in my docs folder.
Re: Where can I find more information on wx.wxMessageBox ?
« Reply #2 on: October 21, 2019, 06:44:08 AM »
You can find more info on wxMessageBox here: https://docs.wxwidgets.org/3.1/group__group__funcmacro__dialog.html#ga193c64ed4802e379799cdb42de252647

wxMessageBox uses styles from wxMessageDialog which can be found at the top of the page here: https://docs.wxwidgets.org/3.1/classwx_message_dialog.html

The styles go where the '16' is in your example. So to show a message box with an 'Ok' button with an error symbol it would be the following
Code: [Select]
local rc = wx.wxMessageBox("This is my Message", "This is my Caption", wx.wxOK + wx.wxICON_ERROR)

In this case, if you selected the OK button, rc would be equal to 'wx.wxOK'.

Hope this helps

Offline jevs

*
  •  315 315
    • View Profile
Re: Where can I find more information on wx.wxMessageBox ?
« Reply #3 on: October 21, 2019, 08:15:02 AM »
I did find those pages, but I did not find anything about those numbers representing different options. The numbers do work though and you can use them as variables to determine what to do with the answer after it is clicked.

Ultimately I have it working, but I still don't know how someone came to know about those numbers being different select options for the message box.

Offline jevs

*
  •  315 315
    • View Profile
Re: Where can I find more information on wx.wxMessageBox ?
« Reply #4 on: October 21, 2019, 09:28:58 PM »
If anyone else stumbles upon this thread looking for answers, open this file from your computer that has Mach4 installed.......

C:\Mach4Hobby\LuaExamples\MessageBoxes.mcs

Best to open it with the Zero Brain Editor, but most text programs should open it.

I stumbled upon this today digging around for info.

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Where can I find more information on wx.wxMessageBox ?
« Reply #5 on: October 22, 2019, 12:12:17 PM »
Quote
Ultimately I have it working, but I still don't know how someone came to know about those numbers being different select options for the message box.

I do not remember exactly where but pretty sure they were in the wx docs somewhere.
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!