Button set and apply in screeneditor
Moderators: TomKerekes, dynomotion
-
- Posts: 47
- Joined: Fri Nov 01, 2019 7:18 pm
Button set and apply in screeneditor
Hi, I try to find where are the control for the button "set" (IDC_SetX for example) and I din't find anything about how you open a windows (Set Value) and how you change the value IDC_PosX with the new value.
Also, I try to find where are the control for the button "apply" (IDC_SpindleRateApply for example) and I didn't find anything about how you change the value.
Also, I try to find where are the control for the button "apply" (IDC_SpindleRateApply for example) and I didn't find anything about how you change the value.
- TomKerekes
- Posts: 2676
- Joined: Mon Dec 04, 2017 1:49 am
Re: Button set and apply in screeneditor
Hi,
Those buttons basically have fixed functionality that can't be changed. You could replace them with new buttons that do something else. What exactly are you trying to do?
To bring up a numeric input box from a C Program see the example: MessageInputBox.c
To set a GCode Fixture Offset from a C Program see the example: SetFixtureX.c
To change the Spindle Speed Override from a C Program you might call DoPCFloat(PC_COMM_SET_SSO,SSO); similar as FRO is set in the example SetFROwithPot.c To change the current SSO by a factor use: PC_COMM_SET_SSO_INC instead of PC_COMM_SET_SSO.
HTH
Those buttons basically have fixed functionality that can't be changed. You could replace them with new buttons that do something else. What exactly are you trying to do?
To bring up a numeric input box from a C Program see the example: MessageInputBox.c
To set a GCode Fixture Offset from a C Program see the example: SetFixtureX.c
To change the Spindle Speed Override from a C Program you might call DoPCFloat(PC_COMM_SET_SSO,SSO); similar as FRO is set in the example SetFROwithPot.c To change the current SSO by a factor use: PC_COMM_SET_SSO_INC instead of PC_COMM_SET_SSO.
HTH
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
-
- Posts: 47
- Joined: Fri Nov 01, 2019 7:18 pm
Re: Button set and apply in screeneditor
Hi,
I try to make a button and a label.
When you push the button, I want a new window for enter a numerical value. When your number is enter and you push ok, I would like to enter this number in the label and I want to use it in my c program.
I try to make a button and a label.
When you push the button, I want a new window for enter a numerical value. When your number is enter and you push ok, I would like to enter this number in the label and I want to use it in my c program.
-
- Posts: 47
- Joined: Fri Nov 01, 2019 7:18 pm
Re: Button set and apply in screeneditor
Hi Tom,
the MessageInputBox.c make what I want, but I would like to write the value in a label.
the MessageInputBox.c make what I want, but I would like to write the value in a label.
- TomKerekes
- Posts: 2676
- Joined: Mon Dec 04, 2017 1:49 am
Re: Button set and apply in screeneditor
Hi,
You might consider just using an Edit Control to enter a value instead of an Input dialog box.
See the Add Example of how to write a value to a DROLabel. See the Video here at the 13 minute mark
Another example showing instantaneous Feed Rate in a DROLabel on the screen
You might consider just using an Edit Control to enter a value instead of an Input dialog box.
See the Add Example of how to write a value to a DROLabel. See the Video here at the 13 minute mark
Another example showing instantaneous Feed Rate in a DROLabel on the screen
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
-
- Posts: 47
- Joined: Fri Nov 01, 2019 7:18 pm
Re: Button set and apply in screeneditor
Thanks Tom,
with your help I can make what I want with the button and the label.
But, how I can store the value in a "persistent" place, i.e. when I change the screen or when I rebbot, the value is kept.
with your help I can make what I want with the button and the label.
But, how I can store the value in a "persistent" place, i.e. when I change the screen or when I rebbot, the value is kept.
- TomKerekes
- Posts: 2676
- Joined: Mon Dec 04, 2017 1:49 am
Re: Button set and apply in screeneditor
Hi,
Again if you used Edit Controls they automatically persist into file <>\KMotion\Data\EditControlPersist.txt. Here is a video that included demonstrating Edit Controls
Otherwise to get persistence you would need to write the value to a PC Disk file and read the value from the PC Disk file on Initialization. See the example DiskWriteRead.c:
Again if you used Edit Controls they automatically persist into file <>\KMotion\Data\EditControlPersist.txt. Here is a video that included demonstrating Edit Controls
Otherwise to get persistence you would need to write the value to a PC Disk file and read the value from the PC Disk file on Initialization. See the example DiskWriteRead.c:
Code: Select all
#include "KMotionDef.h"
main()
{
FILE *f;
char s[256];
double a=123.456,b=999.999,c=0.001;
double x=0,y=0,z=0;
int result;
// write 3 comma separated values to a disk file
f=fopen("c:\\Temp\\KFlopData.txt","wt");
fprintf(f,"%f,%f,%f\n",a,b,c);
fclose(f);
// read them back in
f=fopen("c:\\Temp\\KFlopData.txt","rt");
if (!f)
{
printf("Unable to open file\n");
return;
}
// read a line and convert 3 doubles
result=fscanf(f,"%lf,%lf,%lf",&x,&y,&z);
fclose(f);
printf("# values converted = %d, x=%f, y=%f, z=%f\n",result,x,y,z);
}
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
-
- Posts: 47
- Joined: Fri Nov 01, 2019 7:18 pm
Re: Button set and apply in screeneditor
Thank you so much.
-
- Posts: 47
- Joined: Fri Nov 01, 2019 7:18 pm
Re: Button set and apply in screeneditor
Where I can initialise my things before the screen appear?
- TomKerekes
- Posts: 2676
- Joined: Mon Dec 04, 2017 1:49 am
Re: Button set and apply in screeneditor
Hi,
One method is that any simple Label Control that has a Screen Script associated with it will execute the Script whenever the Screen has been loaded.
So for example here is the example DualPane3AxisCode.scr with a new DROLabel and simple Label added. The DROLabel will be initialized (to 1234) whenever the Screen Loads:
The DROLabel is configured as shown here:
The Label with associated Screen Script is shown here. The Program SetLabel.c will be executed whenever the screen loads. Any existing Label or hidden Label may also be used:
A simple SetLabel.c program that puts 1234 into the DROLabel. Of course data could be anything from anywhere.
HTH
One method is that any simple Label Control that has a Screen Script associated with it will execute the Script whenever the Screen has been loaded.
So for example here is the example DualPane3AxisCode.scr with a new DROLabel and simple Label added. The DROLabel will be initialized (to 1234) whenever the Screen Loads:
The DROLabel is configured as shown here:
The Label with associated Screen Script is shown here. The Program SetLabel.c will be executed whenever the screen loads. Any existing Label or hidden Label may also be used:
A simple SetLabel.c program that puts 1234 into the DROLabel. Of course data could be anything from anywhere.
Code: Select all
#include "KMotionDef.h"
#define TMP 10 // which spare persist to use to transfer data
#include "KflopToKMotionCNCFunctions.c"
main()
{
// Put it onto the Screen
DROLabel(1000, 162, "1234");
printf("SetLabel\n");
}
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.