Dialog property question

I think this question is specific to EditorX since I don’t see the same problem in TUI.

I have a dialog that requests the user to select a model number and enter a serial number.
I also allow both items to be populated automatically from a scanned QR code if it matches a specific pattern.

This all works, but the problem I see is if the user mistakenly enters or scans the wrong value into the SerialNumber field and attempts to delete it an re-enter or scan.

The SerialNumber ‘set’ is only be called the first time the user enters it. If they attempt to modify it, the ‘set’ method is never called again and they must cancel the operation and restart the test plan to be able to re-enter the proper serial number.

As mentioned, this works in TUI though it is very different because of its implementation of IDisplayAnnotation. I am not currently set up on Windows to try Editor instead of EditorX.

Is this expected behavior?

class DutSelectDialog: IDisplayAnnotation
{
    public enum DialogResult
    {
        Cancel = 2, Ok = 1
    }

    public DutSelectDialog(List<string> partNumbers)
    {
        PartNumbers = partNumbers;            
    }

    public List<string> PartNumbers {get; private set;}

    private string _serialNumber;

    [Display("Serial Number", Order:100)]
    public string SerialNumber 
    {
        get => _serialNumber;
        set {
            // Specific QR pattern that allows setting both the serial number and part number
            var match = new Regex(@"\A(\d{8}).*(\d\.\d)(\d{11})\Z").Match(value);
            if (match.Success && (match.Groups.Count == 4))
            {
                _serialNumber = match.Groups[3].Value;
                string partnumber = match.Groups[1].Value + "REV-" + match.Groups[2].Value;
                foreach(var pn in PartNumbers)
                {
                    if (pn.StartsWith(partnumber))
                    {
                        PartNumber = pn;
                        break;
                    }
                }
            }
            else
            {
                _serialNumber = value;
            }
        }
    }

    [AvailableValues(nameof(PartNumbers))]
    [Display("Part Number", Order:102)]
    public string PartNumber {get; set;}

    [Layout(LayoutMode.FloatBottom | LayoutMode.FullRow)]
    [Submit]
    public DialogResult Response { get; set; }

    public string Name { get => "Scan Board QR Code"; }
    string IDisplayAnnotation.Description => string.Empty;
    string[] IDisplayAnnotation.Group => Array.Empty<string>();
    double IDisplayAnnotation.Order => -10000;
    bool IDisplayAnnotation.Collapsed => false;
}

Thanks,
Wittrock

Hi @wittrock,

The behavior that you’re seeing is definitely a bug, but currently I do not have the capacity to look into it. Sorry about that.

FYI, we’re going to release a cross platform version of Editor (it will also work with Community License) in the near future. In the meantime, we have a preview version that will work on Ubuntu 22. Will you be interested to give it a try?

Regards,
Khang

1 Like

Hello @khang-yong ,

Thanks for confirming this isn’t expected.

That’s great that you are working on a cross platform Editor.
I would love to give it a try even if it is an early preview.

I started a cross platform operator GUI using Avalonia, but I must admit I didn’t get very far before I had to move on to other things.

Having an Editor that is common among the supported platforms would be a great move.

Thanks,
Wittrock

Hi @wittrock,

Do you have a cloud storage where I can upload the preview installer to you? It’s a pretty huge file (214MB, not optimized). You can email me at khang-yong.ng@keysight.com the link to upload the file to.

Regards
Khang

Thanks @khang-yong ,

I have sent you a link.

-Wittrock