You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(timerangeselector): support uifigure parents (replace uicontrol labels with uilabel when needed) (#145)
* fix(timerangeselector): support uifigure parents via uilabel branch
uicontrol is not supported inside figures created with uifigure(...),
so TimeRangeSelector crashes when CompanionEventViewer hosts it
(MATLAB Tests (A-D) CI: TestCompanionEventViewer ~15 tests).
Detect uifigure parents in the constructor via isprop(hAncFig,
'AutoResizeChildren') — that property exists on uifigure only; classical
figure handles lack it even though both report class matlab.ui.Figure.
buildGraphics_ then dispatches to either buildLabelsClassical_ (existing
uicontrol path, normalized Position, unchanged) or buildLabelsUIFigure_
(new uilabel path, pixel Position recomputed on every hPanel
SizeChangedFcn — same pattern as MultiStatusWidget, IconCardWidget,
TextWidget).
setRangeLabels now routes through a single setLabelText_ helper that
writes Text on uilabel and String on uicontrol, so the public contract
is unchanged for DashboardEngine. The panel's previous SizeChangedFcn
is saved and re-fired so we don't strand sibling resize handlers. The
saved handle is restored on delete via restoreCallbacks_.
Backward compatible with the dashboard path (DashboardEngine still
creates a classical figure() and the uicontrol code path is bit-for-bit
identical). No new toolboxes; pure MATLAB.
Verified statically: `mh_style` clean on touched code (3 pre-existing
warnings on lines unrelated to this fix); only uicontrol callsites in
the file are inside buildLabelsClassical_; setRangeLabels' label-handle
access now lives in one helper.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(timerangeselector): probe-based uifigure detection (replace broken isprop heuristic)
The original isprop(fig, 'AutoResizeChildren') discriminator returns TRUE for BOTH classical figures AND uifigures on R2020b+ — confirmed in a live MATLAB probe. Result: every classical-figure construction misroutes to buildLabelsUIFigure_, which then errors because uilabel cannot be parented to a classical figure's uipanel on CI Linux MATLAB. This broke ~14 test files in batch Dashboard and 4 other batches on PR #145's CI.
Replace with a hidden-probe pattern: try uicontrol on hPanel; if MATLAB rejects it ("Functionality not supported with figures created with the uifigure function"), switch to uilabel. Bulletproof across MATLAB releases — actually tests parent compatibility rather than guessing from properties.
Verified locally: classical figure → classical path (uicontrol), label class = matlab.ui.control.UIControl. uifigure on local macOS also takes the classical path because macOS MATLAB allows uicontrol-in-uifigure (CI Linux rejects it, which is the case the probe catches).
* style(timerangeselector): move || to end-of-line in probe-detection (mh_style: operator_after_continuation)
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments