Page 1 of 1

Change value of a edit box in the screeneditor with a c program

Posted: Fri Nov 08, 2019 8:09 pm
by 4minnovations
Hi,
I try to figure how to change a value of a edit box in the screeneditor with a c program.

Re: Change value of a edit box in the screeneditor with a c program

Posted: Fri Nov 08, 2019 9:40 pm
by TomKerekes
Hi,

An Edit Control is normally used for Operator Input. There is only a method of reading the Control not writing. Why do you need to change the value from a C Program?

Re: Change value of a edit box in the screeneditor with a c program

Posted: Sat Nov 09, 2019 2:48 pm
by 4minnovations
Hi Tom,
I have a value that I need in two different screen. This value is calculated, but the user can mdoify them.

Re: Change value of a edit box in the screeneditor with a c program

Posted: Sat Nov 09, 2019 8:54 pm
by TomKerekes
Hi 4minnovations,

Here is a patch for V4.35b that should allow setting Text in an Edit Control. It also includes some other patches (More unicode support for controls, combo box controls, and the Set DRO to half option).

New KMotionCNC.exe copy to \KMotion435b\KMotion\Release

New KflopToKMotionCNCFunctions.c which includes new SetEditControl function copy to \KMotion435b\C Programs

Example C Program to set an Edit Control Text

Code: Select all

#include "KMotionDef.h"

#define TMP 10 // which spare persist to use to transfer data
#include "KflopToKMotionCNCFunctions.c"

void main()
{
	char s[80];
	
	// Convert number to string
	sprintf(s,"%g",123.4);
	
	// Put it onto the Screen
	SetEditControl(1000, 160, s);
}
Sources if needed.

Re: Change value of a edit box in the screeneditor with a c program

Posted: Mon Nov 11, 2019 4:02 pm
by 4minnovations
Thanks Tom,
it's work perfectly.