Fix #739: allow editing ByteString values when writing a node - #746
Merged
Conversation
Add a dedicated BuiltInType.ByteString case to GuiUtils.EditValue so a byte array is edited via a text dialog (hex or base64) instead of falling through to the read-only complex value editor. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
When writing a node whose value is a
ByteString/byte array in the UA Sample Client, the value editor did not let the user modify the bytes.GuiUtils.EditValuehad noBuiltInType.ByteStringcase, so a ByteString fell through to the read-onlyComplexValueEditDlgwhereDataListCtrlrenders the bytes as 16-byte blocks and disables the Edit action.This change adds a dedicated
BuiltInType.ByteStringcase toGuiUtils.EditValue(inSamples/ClientControls.Net4/Configuration/Common (OLD)/GuiUtils.cs). It renders the current bytes as a space-separated hex string, opens the existingStringValueEditDlgfor editing, and parses the edited text back into abyte[].Parsing is lenient:
ParseByteStringaccepts hex with optional0xprefixes, commas, dashes, and whitespace (so both0A 1B 2Cand0x0A,0x0Bwork), and falls back to base64 when the input is not valid hex. Invalid input raises a clearFormatExceptiondescribing the accepted formats. ReusingStringValueEditDlgkeeps the change small and avoids a new dialog.Related Issues
Types of changes
Checklist
Further comments
The client sample project builds successfully with the change (only pre-existing warnings remain). This is a WinForms sample control with no automated UI test coverage, so the fix was validated by building and by reasoning through the edit/parse round-trip.