Page 1 of 2

Writing ° to text field

PostPosted: Sat Nov 26, 2016 4:05 pm
by ger21
Not sure if this is a bug or not.
I'm writing a probing macro, and want to write a degree symbol (° --- alt + 248) to a textfield, but I'm seeing some strange results.

At first I tried using in the .ssf file:

AS3jog.Addfield("", "Arial", "right", 22, -16777216, 636, 307, 122, "showfieldnb", 0, 0, 20349, 1);
AS3jog.Filterfieldtext("0123456789.\\-°", 20349);

In my Constructor macro, I have:

readfield = exec.Readkey("2017_Fields", "20349", "0.0°");
AS3jog.Setfieldtext(readfield, 20349); // Set Edge Angle

When I start UCCNC, it works as expected, giving me this:
deg1.jpg
deg1.jpg (15.76 KiB) Viewed 24362 times


To test what would happen if when my macro writes to the field, I wrote a macro, M20998, with :

AS3jog.Setfieldtext("25.39°", 20349); // Set Edge Angle

When I run it from the MDI, I get this:

deg2.jpg
deg2.jpg (22.95 KiB) Viewed 24362 times


Removing:

AS3jog.Filterfieldtext("0123456789.\\-°", 20349);

doesn't seem to make any difference. ( At first this caused my M20998 to not execute from MDI, but now I can't repeat it )

Another related issue.
I had manually edited the key value in the profile to be "0.0°"
I have another macro to write the keys while I'm testing, using:

string fieldtext = AS3jog.Getfield (20349);
exec.Writekey("2017_Fields", "20349", fieldtext);

When this macro is run with field #20349 having "0.0°", the key is saved as:

20349=0.0°

While typing this message, I realized that I don't nee to save these values, so this is less of an issue for me. But still a bug imo.

It's not a big deal if these issues can't be fixed, but they seem like bugs.
Or maybe I just don't know what I'm doing? :)

Re: Writing ° to text field

PostPosted: Sat Nov 26, 2016 6:18 pm
by ger21
After some Googling, I found that this works:

string test = "25.405" ;
string degree = ((char)0x00B0).ToString();
AS3jog.Setfieldtext(test + degree, 20349); // Set Edge Angle

But, as I stated in my original post, Setfieldtext() works in the Constructor macro, but not when called from MDI.

Re: Writing ° to text field

PostPosted: Sat Nov 26, 2016 9:00 pm
by cncdrive
Looks like a character coding issue, will try to look after what is causing this.

Re: Writing ° to text field

PostPosted: Sat Nov 26, 2016 11:29 pm
by ger21
Also.
Whenever I save the screen during editing.
If the field contains the value "0.0°", the value "0.0°" gets written to the Setfieldtext function in the .ssf

Re: Writing ° to text field

PostPosted: Sun Nov 27, 2016 5:05 pm
by cncdrive
I think I could resolve this, but please check and test the new release 1.2030, last post in this thread: viewtopic.php?f=2&t=240&start=20

Re: Writing ° to text field

PostPosted: Sun Nov 27, 2016 5:41 pm
by ger21
Yes, this last issue seems to be fixed now.
I saved the screen, and restarted, and it works fine. The .ssf file is now being saved correctly. Thanks for the excellent support.

Re: Writing ° to text field

PostPosted: Sat Dec 17, 2016 2:53 pm
by ger21
While this is fixed in the .ssf file, it's not working when called from a button.

M20545.txt
AS3jog.Setfieldtext("0.0°", 20349); // Write angle to DRO

gives me 0.0°

Re: Writing ° to text field

PostPosted: Sat Dec 17, 2016 5:20 pm
by cncdrive
In which UCCNC version?
1.2029 did not have this fixed yet, 1.2030 had.
Could you confirm that you testing this with version 1.2030 and still have the mentioned issue?

Re: Writing ° to text field

PostPosted: Sat Dec 17, 2016 5:30 pm
by ger21
My mistake. I thought it was working when the screen loaded, but the problem was when saving the screen.

I'm using the 1.2029 release version from today, as the 1.2030 version was too buggy for me to use.
Thanks.

Re: Writing ° to text field

PostPosted: Wed Jan 11, 2017 1:36 am
by ger21
ger21 wrote:While this is fixed in the .ssf file, it's not working when called from a button.

M20545.txt
AS3jog.Setfieldtext("0.0°", 20349); // Write angle to DRO

gives me 0.0°


This is still not working in version 1.2031