$extra=[Native41]::Top([uint32]$l.pid,'OpenHoops extra fields')
$observed=Get-Content "$o\ui-inspect.json" -Raw|ConvertFrom-Json
$bar=[Native41]::GetParent([Native41]::Button($extra,'Apply fields'))
$candidates=@($observed.controls|Where-Object{$_.class -match '^WindowsForms10.Window.8' -and $_.handle -ne $bar.ToInt64()})
if($candidates.Count -ne 1){throw 'Observed extra grid is ambiguous'}
$grid=[IntPtr][long]$candidates[0].handle
if(![Native41]::IsChild($extra,$grid)){throw 'Observed grid is not owned by the extra-fields window'}
$null=[Native41]::SetForegroundWindow($extra)
$point=[IntPtr]((36 -shl 16) -bor 600)
foreach($message in @(513,514)){$null=[Native41]::PostMessage($grid,$message,[IntPtr]1,$point);Start-Sleep -Milliseconds 100}
$null=[Native41]::PostMessage($grid,256,[IntPtr]113,[IntPtr]::Zero);$null=[Native41]::PostMessage($grid,257,[IntPtr]113,[IntPtr]::Zero)
Start-Sleep -Milliseconds 300
$input=[Native41]::Class($grid,'EDIT')
$null=[Native41]::SendMessage($input,12,[IntPtr]::Zero,'Modern display name')
if([Native41]::Title($input) -ne 'Modern display name'){throw 'Native edit input readback differs'}
Click $extra 'Apply fields'
Start-Sleep -Milliseconds 900
Click $main 'Review changes';Start-Sleep -Seconds 2
$report=[Native41]::Top([uint32]$l.pid,'Changes since opening')
$summary=@([Native41]::Children($report)|ForEach-Object{[Native41]::Title($_)}|Where-Object{$_ -match 'changes.*added records'})
@{pid=$l.pid;utc=[DateTime]::UtcNow.ToString('o');editedField='org.openhoops.ui.display_name';editedValue='Modern display name';record=0;section=3;summary=$summary;sourceSha256=(Get-FileHash "$r\roster-editor41e\Studio.ROS").Hash;companionSha256=(Get-FileHash "$r\roster-editor41e\Studio.ROS.openhoops.json").Hash}|ConvertTo-Json -Depth 4|Set-Content "$o\ui-edit.json"
