Hello Guest it is May 16, 2021, 05:41:25 AM

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

0 Members and 1 Guest are viewing this topic.

Offline Chaoticone

*
  • *
  •  5,626 5,626
  • Precision Chaos
    • View Profile
Re: Message Box with Cancel?
« Reply #10 on: February 08, 2018, 02:36:17 PM »
I'm not sure what your exact flow is but you may need to do a couple of message boxes. One ask a question........ then pop up next based on response. Could have lots of options for next. Might even need more steps which = more message boxes. I hope that makes sense.
;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 #11 on: February 08, 2018, 02:52:29 PM »
Correct me if i'm wrong but wx.wxGetNumberFromUser() only works with integers. 

hth

rt
Re: Message Box with Cancel?
« Reply #12 on: February 08, 2018, 03:06:17 PM »
Brett,
I only put the 2nd wx.wx.messagebox in there to test with.  I will make it loop until the operator puts a number in there, I'm forcing them to set the current tool to the actual tool in turret rather than just assuming the operator will be sure to put the correct tool number in the DRO.  This code will run only on the start up. 

Speaking of running only 1 time.
I put this in the "First Run PLC Script."  It didn't crash and as far as I can tell it didn't alter anything else.  Is that okay?  Or is there a better way to make something run only on startup?   Open to any and all suggestions. 

Also, I thought we could use Global Variables (like "testcount" in PLC Script) everywhere, even in a macro.  It won't let me.
Chad Byrd
Re: Message Box with Cancel?
« Reply #13 on: February 08, 2018, 03:07:46 PM »
Correct me if i'm wrong but wx.wxGetNumberFromUser() only works with integers. 

hth

rt

I'm using this to get the "Actual Tool" that is in the turret, so all I need is the integer. 
This box pops up, the operator looks at the turret sees that "Tool #" is the current tool, they type it in the message box and it updates the Current Tool DRO.
Chad Byrd
Re: Message Box with Cancel?
« Reply #14 on: February 08, 2018, 03:11:23 PM »
Yes, but you asked also asked for a way to ask the user for a number for a 'position'.  Thought I would save someone in the future reading this thread some time so they don't try it for that.
Re: Message Box with Cancel?
« Reply #15 on: February 08, 2018, 03:12:40 PM »
Yes, but you asked also asked for a way to ask the user for a number for a 'position'.  Thought I would save someone in the future reading this thread some time so they don't try it for that.

Gotcha!   ;)
Chad Byrd

Offline Chaoticone

*
  • *
  •  5,626 5,626
  • Precision Chaos
    • View Profile
Re: Message Box with Cancel?
« Reply #16 on: February 08, 2018, 03:20:00 PM »
Quote
I put this in the "First Run PLC Script."  It didn't crash and as far as I can tell it didn't alter anything else.  Is that okay?  Or is there a better way to make something run only on startup?   Open to any and all suggestions.  

Yes, that is acceptable. I would build the function in the screen load script and call that function only once from the PLC script by doing like you have in first run or maybe even third run.

Quote
Also, I thought we could use Global Variables (like "testcount" in PLC Script) everywhere, even in a macro.  It won't let me.

I like calling them regionally global.  ;D

Macros and screens run in 2 different instances so ones global is not global to the other. The only thing (that i know of) right now that is global global are registers. They can be read and written to from the screen, macros, modules, lua panels, etc.
;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 #17 on: February 08, 2018, 03:34:25 PM »
Quote
I put this in the "First Run PLC Script."  It didn't crash and as far as I can tell it didn't alter anything else.  Is that okay?  Or is there a better way to make something run only on startup?   Open to any and all suggestions. 

I like calling them regionally global.  ;D

Brett, I like it! lol :)
I thought about making a function.  It would make it a little cleaner.  I'll give that a try next. 
Chad Byrd
Re: Message Box with Cancel?
« Reply #18 on: February 08, 2018, 04:45:34 PM »
This is working great!
I went ahead and made it a function in the screen load script; just to tidy things up.  

I also put it on the 25th scan.  

if testcount == 25 then
SetActualTool()
end

It was popping up right as Mach4 was initializing, and it was hiding it behind Mach.  So, moved it to 25 and it pops up on the screen just fine, in about 1.5 seconds. 
« Last Edit: February 08, 2018, 04:47:05 PM by Cbyrdtopper »
Chad Byrd

Offline Chaoticone

*
  • *
  •  5,626 5,626
  • Precision Chaos
    • View Profile
Re: Message Box with Cancel?
« Reply #19 on: February 08, 2018, 05:44:14 PM »
 :)
;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!