Hello Guest it is May 09, 2021, 10:41:51 PM

Author Topic: Message Box with Cancel?  (Read 4083 times)

0 Members and 1 Guest are viewing this topic.

Re: Message Box with Cancel?
« Reply #20 on: February 09, 2018, 10:00:56 AM »
So,
to make this loop, I was going to do something like this:

while rc == -1 do
local ActualTool = wx.wxGetNumberFromUser()
local rc = ActualTool
end

but it won't change the rc inside the loop.  I changed the variable name to Test and it returned an ERROR.   Why is that?

While writing this reply, I was testing the loop again.  It isn't even changing my variable ActualTool from the GetNumberFromUser. 
« Last Edit: February 09, 2018, 10:03:01 AM by Cbyrdtopper »
Chad Byrd

Offline DazTheGas

*
  •  753 753
  • DazTheGas
    • View Profile
Re: Message Box with Cancel?
« Reply #21 on: February 09, 2018, 02:52:37 PM »
Try using the repeat command like this

Code: [Select]
local inst = mc.mcGetInstance()
repeat
    local ActualTool = wx.wxGetNumberFromUser("What tool is in the turret?", "Tool # ","Current Tool", 1, 1, 6) -- Default, Min, Max.
until ActualTool ~= -1
--mc.mcToolSetCurrent(inst, ActualTool)
wx.wxMessageBox(tostring(ActualTool))

DazTheGas
Theres always time for a choccy biccy
Re: Message Box with Cancel?
« Reply #22 on: February 09, 2018, 04:26:02 PM »
Thanks Daz.  That's exactly what I was looking for.  I had no idea that command even existed!! :)
Chad Byrd

Offline Chaoticone

*
  • *
  •  5,626 5,626
  • Precision Chaos
    • View Profile
Re: Message Box with Cancel?
« Reply #23 on: February 09, 2018, 05:28:06 PM »
Thanks Daz.  That's exactly what I was looking for.  I had no idea that command even existed!! :)

You will love this then.......

http://www.lua.org/manual/5.2/
;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!
Re: Message Box with Cancel?
« Reply #24 on: February 09, 2018, 07:28:15 PM »
Hi,
Chaoticone's link to the Lua 5.2 manual is great, I usually have it open when I'm doing any coding, I still have to delve into it a lot.

Just be warned there is a Lua 5.3 and some things change and can and will trip you up if you blithely believe that Mach can handle 5.3.

Craig
My wife left with my best friend...
     and I miss him!
Re: Message Box with Cancel?
« Reply #25 on: February 10, 2018, 10:34:09 AM »
Thanks for the info, Brett and Craig.
I've looked through that manual before.  I don't know why I didn't think to look for a "Repeat" command.  Couldn't see the forest for the trees I guess.
Craig,
I'm guessing Mach uses the 5.2 stuff then?
Chad Byrd

Offline DazTheGas

*
  •  753 753
  • DazTheGas
    • View Profile
Re: Message Box with Cancel?
« Reply #26 on: February 10, 2018, 10:49:23 AM »
HAHAHAHA Once youve finished with the Lua Manual you can then move on to wxLua Manual  :o ;D :D ;)

DazTheGas
Theres always time for a choccy biccy

Offline Chaoticone

*
  • *
  •  5,626 5,626
  • Precision Chaos
    • View Profile
Re: Message Box with Cancel?
« Reply #27 on: February 10, 2018, 11:00:44 AM »
HAHAHAHA Once youve finished with the Lua Manual you can then move on to wxLua Manual  :o ;D :D ;)

DazTheGas

Very true Daz. If the reference manual makes you happy the wxLua manual might put you over the edge.  ;D

In the reference manual, look at http://www.lua.org/manual/5.2/manual.html#9
« Last Edit: February 10, 2018, 11:02:18 AM by Chaoticone »
;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!
Re: Message Box with Cancel?
« Reply #28 on: February 10, 2018, 12:33:55 PM »
After testing the "Repeat" Command.  It isn't working as expected.  When I run through the code, it returns an ERROR when it reads "while actualtool ~=1"  After I input a number in the box, it reads that number just fine.  But as soon as the debugger gets on the "While" line, it returns an ERROR in the ActualTool Variable.
Chad Byrd

Offline DazTheGas

*
  •  753 753
  • DazTheGas
    • View Profile
Re: Message Box with Cancel?
« Reply #29 on: February 10, 2018, 01:26:01 PM »
post the whole code you are using as I have tested what i posted and all works.

DazTheGas
Theres always time for a choccy biccy