User fields update bug?

If you think you've found a bug post it here.

User fields update bug?

Postby A_Camera » Tue May 02, 2017 10:47 am

Hi,

In the above thread:

http://www.forum.cncdrive.com/viewtopic.php?f=9&t=538#p3750

I am presenting my probe screen and offering it for anyone who wishes to use it. Unfortunately, it seems that there is an issue which may be a bug, or may be something I am doing wrong.

I am using the new user fields feature, but it seems that it is not working as expected, at least not for me.

If I click in the field and not change the value, just leave and click in another field, the value which was in the field is lost, the field is cleared (literally, not set to zero, but empty). This is not the case with the axis DRO fields, so how can i preserve the value and prevent that the value is lost because of a mistake?

My constructor macro looks like this:

Code: Select all
    AS3.Setfield(Convert.ToDouble(exec.Readkey("UserTextfields", "20002", "0.0")), 20002); // Set numeric field
    AS3.Validatefield(20002);
    AS3.Setfield(Convert.ToDouble(exec.Readkey("UserTextfields", "20003", "0.0")), 20003); // Set numeric field
    AS3.Validatefield(20003);


I don't understand why this is not working or what else is needed. According to Gerry, it is working for him, so what is the difference? Why?

Would appreciate any help.
A_Camera
 
Posts: 639
Joined: Tue Sep 20, 2016 11:37 am

Re: User fields update bug?

Postby ger21 » Tue May 02, 2017 11:27 am

Just a guess, but what happens if you remove the "Covert.ToDouble"? I don't convert to double in my Contructor macro.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: User fields update bug?

Postby dezsoe » Tue May 02, 2017 11:38 am

ger21 wrote:Just a guess, but what happens if you remove the "Covert.ToDouble"? I don't convert to double in my Contructor macro.

It's a numeric field, so he has to convert it. He could use text fields, but than he has to convert the values when using them.
The problem is something else, because I use the same method and it works. I promised to check it in the evening.
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: User fields update bug?

Postby ger21 » Tue May 02, 2017 11:48 am

I don't convert mine, and they work fine.
I use this code, with no problems, using a "FieldNB" type.

readfield = exec.Readkey("UserTextfields", "20332", "0.000");
AS3.Setfieldtext(readfield, 20332); // Set Park #4 Z Value
AS3.Validatefield(20332);


You only need to convert when you read it, not when you write to it.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: User fields update bug?

Postby ger21 » Tue May 02, 2017 11:52 am

A_Camera,
What field type are you using, and what are your Min and Max values set to?
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: User fields update bug?

Postby A_Camera » Tue May 02, 2017 12:57 pm

ger21 wrote:A_Camera,
What field type are you using, and what are your Min and Max values set to?


Max: 1.7976931348623157E+308
Min: -1.7976931348623157E+308

I tried to play with the max/min because that was what I suspected first, but it makes no difference. I don't really need that large interval, and really only need positive numbers but since the axis DROs use the above, for now, I have those.

Textfilter: 0123456789. in one and 0123456789.\- in the other. Also here, the difference is because I played with the alternative. Also had the filter empty, but it made no difference.

Type: textfieldnb but also tested with fieldnb.

Gerry, I was thinking of testing your way, i.e. not converting in the constructor macro, but it is not the most convenient way because it would require conversion in the macros.
A_Camera
 
Posts: 639
Joined: Tue Sep 20, 2016 11:37 am

Re: User fields update bug?

Postby ger21 » Tue May 02, 2017 1:28 pm

I use Getfielddouble() in my macros, so no conversion is necessary.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: User fields update bug?

Postby dezsoe » Tue May 02, 2017 1:43 pm

ger21 wrote:I use Getfielddouble() in my macros, so no conversion is necessary.

That makes the conversion. :)

But the problem is not with the field type. I use the same method and it works fine.

M99998:
Code: Select all
AS3.Addfield("", "Arial", "right", 12, 0, 1050, 583, 40, "field", -10.0, 10.0, 20992, 1);
AS3.Setfield(0.00, 20992);
AS3.Filterfieldtext("0123456789.\\-", 20992);
...
AS3.Setfield(Convert.ToInt32(exec.Readkey("DASH", "GageHeight", "0.0")), 20992);

M99999:
Code: Select all
exec.Writekey("DASH", "GageHeight", AS3.Getfield(20992));

The only difference is that I save my variables myself in the destructor macro, but that does not effect on the field.
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: User fields update bug?

Postby A_Camera » Tue May 02, 2017 2:00 pm

This is very strange. I have now tested also as textfield, as well as using Getfielddouble(), which of course converts also, but at at later stage. It is still the same behaviour as before, the field is cleared if I just click on it and leave. The field is updated normally if I just enter a new value and is updated as expected after I close UCCNC and restart it.
A_Camera
 
Posts: 639
Joined: Tue Sep 20, 2016 11:37 am

Re: User fields update bug?

Postby A_Camera » Tue May 02, 2017 2:06 pm

dezsoe wrote:The only difference is that I save my variables myself in the destructor macro, but that does not effect on the field.

There is another difference... Hungarian, vs. English and Swedish... though I don't believe it has anything to with that.

Thanks for yours and Gerry's engagement. I really appreciate it.
A_Camera
 
Posts: 639
Joined: Tue Sep 20, 2016 11:37 am

Next

Return to Report a bug

Who is online

Users browsing this forum: No registered users and 6 guests