From 421696c5e0cb1d4b126306bd24e662485ecbe742 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 28 Apr 2026 03:36:09 +0000 Subject: [PATCH] Clean up GUIDE compatibility review comments Agent-Logs-Url: https://github.com/kk14222/3D_EDFM_SIM-X/sessions/a128ab7f-6b94-4048-a847-f2dc37bbe0ab Co-authored-by: kk14222 <217880052+kk14222@users.noreply.github.com> --- gui_support/app/EDFMAppController.m | 11 ++++++++++- gui_support/app/EDFMGuideComponent.m | 11 +++++++---- gui_support/app/EDFMSimulatorGuide.m | 4 ++-- gui_support/app/createEDFMSimulatorGuideLayout.m | 2 +- gui_support/app/launch_edfm_simulator_app.m | 2 +- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/gui_support/app/EDFMAppController.m b/gui_support/app/EDFMAppController.m index 1c07729..4b90f5f 100644 --- a/gui_support/app/EDFMAppController.m +++ b/gui_support/app/EDFMAppController.m @@ -1527,10 +1527,19 @@ classdef EDFMAppController < handle try uialert(obj.App.UIFigure, message, titleText, varargin{:}); catch - errordlg(char(string(message)), char(string(titleText)), 'modal'); + errordlg(obj.toDialogText(message), obj.toDialogText(titleText), 'modal'); end end + function textValue = toDialogText(~, value) + if iscell(value) + textValue = strjoin(string(value), newline); + else + textValue = string(value); + end + textValue = char(textValue); + end + function textValue = formatExceptionSummary(~, ME) lines = { sprintf('Error: %s', ME.message) diff --git a/gui_support/app/EDFMGuideComponent.m b/gui_support/app/EDFMGuideComponent.m index 05d56d1..e655999 100644 --- a/gui_support/app/EDFMGuideComponent.m +++ b/gui_support/app/EDFMGuideComponent.m @@ -55,8 +55,7 @@ classdef EDFMGuideComponent < handle case 'slider' value = get(obj.Handle, 'Value'); case 'edit' - userData = get(obj.Handle, 'UserData'); - if isstruct(userData) && isfield(userData, 'Type') && strcmp(userData.Type, 'numeric') + if obj.isNumericEditField() value = str2double(string(get(obj.Handle, 'String'))); if isnan(value) value = []; @@ -94,8 +93,7 @@ classdef EDFMGuideComponent < handle case 'slider' set(obj.Handle, 'Value', double(value)); case 'edit' - userData = get(obj.Handle, 'UserData'); - if isstruct(userData) && isfield(userData, 'Type') && strcmp(userData.Type, 'numeric') + if obj.isNumericEditField() if isempty(value) set(obj.Handle, 'String', ''); else @@ -276,6 +274,11 @@ classdef EDFMGuideComponent < handle style = ''; end end + + function tf = isNumericEditField(obj) + userData = get(obj.Handle, 'UserData'); + tf = isstruct(userData) && isfield(userData, 'Type') && strcmp(userData.Type, 'numeric'); + end end methods (Static, Access = private) diff --git a/gui_support/app/EDFMSimulatorGuide.m b/gui_support/app/EDFMSimulatorGuide.m index 088b5ad..ec955a2 100644 --- a/gui_support/app/EDFMSimulatorGuide.m +++ b/gui_support/app/EDFMSimulatorGuide.m @@ -11,7 +11,7 @@ if nargin > 0 && ischar(varargin{1}) end startup; -handles = loadOrCreateGuideLayout(); +handles = initializeGuideLayout(); fig = handles.UIFigure; app = EDFMGuideApp(handles); app.Controller = EDFMAppController(app); @@ -25,7 +25,7 @@ if nargout > 0 end end -function handles = loadOrCreateGuideLayout() +function handles = initializeGuideLayout() figFile = fullfile(fileparts(mfilename('fullpath')), 'EDFMSimulatorGuide.fig'); if exist(figFile, 'file') == 2 fig = openfig(figFile, 'reuse', 'invisible'); diff --git a/gui_support/app/createEDFMSimulatorGuideLayout.m b/gui_support/app/createEDFMSimulatorGuideLayout.m index 40d7192..fdf4bc0 100644 --- a/gui_support/app/createEDFMSimulatorGuideLayout.m +++ b/gui_support/app/createEDFMSimulatorGuideLayout.m @@ -1,6 +1,6 @@ function handles = createEDFMSimulatorGuideLayout() %CREATEEDFMSIMULATORGUIDELAYOUT Build the GUIDE-compatible EDFM GUI layout. -% This file is generated from gui_support/app/context.txt to preserve the App Designer layout. +% This layout mirrors the exported App Designer source in context.txt when available. fig = figure('Visible', 'off', 'Name', 'EDFM Simulator', 'NumberTitle', 'off', ... 'MenuBar', 'none', 'ToolBar', 'none', 'Resize', 'on', 'Units', 'pixels', ... diff --git a/gui_support/app/launch_edfm_simulator_app.m b/gui_support/app/launch_edfm_simulator_app.m index 0b710bd..2705038 100644 --- a/gui_support/app/launch_edfm_simulator_app.m +++ b/gui_support/app/launch_edfm_simulator_app.m @@ -1,5 +1,5 @@ function app = launch_edfm_simulator_app() -%LAUNCH_EDFM_SIMULATOR_APP Launch the EDFM Simulator GUI. +%LAUNCH_EDFM_SIMULATOR_APP General EDFM GUI launcher. % MATLAB R2022a-compatible GUIDE/uicontrol implementation is used by default. startup;