I want to have two click buttons in a message box prompt in my too change C Code, one to proceed with the change and one to abort the start of the tool change operation. Anyone know how to do that?
Thanks, Dan
I want to have two click buttons in a message box prompt in my too change C Code, one to proceed with the change and one to abort the start of the tool change operation. Anyone know how to do that?
Thanks, Dan
Hi Dan,
You might see the MessageBox.c example:
It includes a Yes and No button. Using MB_OKCANCEL that includes OK and Cancel might be more appropriate. See KMotionDef.h for other options.Code:#include "KMotionDef.h" #define TMP 10 // which spare persist to use to transfer data #include "KflopToKMotionCNCFunctions.c" main() { int Answer; Answer = MsgBox("Hello World",MB_YESNO|MB_ICONEXCLAMATION); if (Answer == IDYES) printf("Answer is Yes\n"); else printf("Answer is No\n"); }
Regards
TK
http://dynomotion.com
Thanks Tom,
I can't seem to get it to work. I want it to continue with the code if "OK" (return 1) is clicked and exit the tool change sequence if "cancel" is clicked (return 0). But i keep getting a C code error when i try to compile. I seem to be a lot better with examples of code then without lol
Hi Dan,
I don't quite understand what you mean. Do you want to make a function that returns 1 or 0 depending on the answer? Post your code and the error and we can check it.
Regards
TK
http://dynomotion.com
Here it is, I've modified the Automatic Tool change to allow for manual installation of 5 tools Tool 101-105 and the selection of Laser as tool 77, Drill is tool 99 and Laser cross hairs as tool 88. It's gotten alot more complicated since the initial version
It's a work in progress so the formatting sucks. But basically it all works currently. The current code has a message box prompt that says your about to initiate a manual tool change and you click ok and it continues with the tool change. I would like to make is a OK/Cancel option box to abort the tool change entirely if it was incorrectly selected for some reason. It's near the start of the code i made square marker of a bunch of ////// to show where. Once i get this cleaned up i'll share with the dynomotion forum and make a better video.
Thanks,
Dan
Hi Dan,
Try changing:
MsgBox(s, MB_ICONHAND | MB_OK);
To
if (MsgBox(s, MB_ICONHAND | MB_OKCANCEL)==IDCANCEL) return 1;
Regards
TK
http://dynomotion.com
Thanks Tom, We ran out of time Sunday to test this out. Next time I'm back in town we will test it and let you know how it went.
-Dan