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

Moderators: TomKerekes, dynomotion

Post Reply
4minnovations
Posts: 47
Joined: Fri Nov 01, 2019 7:18 pm

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

Post by 4minnovations » Fri Nov 08, 2019 8:09 pm

Hi,
I try to figure how to change a value of a edit box in the screeneditor with a c program.

User avatar
TomKerekes
Posts: 2527
Joined: Mon Dec 04, 2017 1:49 am

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

Post by TomKerekes » Fri Nov 08, 2019 9:40 pm

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?
Regards,

Tom Kerekes
Dynomotion, Inc.

4minnovations
Posts: 47
Joined: Fri Nov 01, 2019 7:18 pm

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

Post by 4minnovations » Sat Nov 09, 2019 2:48 pm

Hi Tom,
I have a value that I need in two different screen. This value is calculated, but the user can mdoify them.

User avatar
TomKerekes
Posts: 2527
Joined: Mon Dec 04, 2017 1:49 am

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

Post by TomKerekes » Sat Nov 09, 2019 8:54 pm

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.
Regards,

Tom Kerekes
Dynomotion, Inc.

4minnovations
Posts: 47
Joined: Fri Nov 01, 2019 7:18 pm

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

Post by 4minnovations » Mon Nov 11, 2019 4:02 pm

Thanks Tom,
it's work perfectly.

Post Reply