Refine GUIDE adapter review feedback
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>
This commit is contained in:
co-authored by
kk14222
parent
0018b44cea
commit
fefb0a5506
@@ -1527,7 +1527,8 @@ classdef EDFMAppController < handle
|
||||
try
|
||||
uialert(obj.App.UIFigure, message, titleText, varargin{:});
|
||||
catch
|
||||
errordlg(obj.formatDialogMessage(message), obj.formatDialogMessage(titleText), 'modal');
|
||||
dialogTitle = obj.formatDialogMessage(titleText);
|
||||
errordlg(obj.formatDialogMessage(message), dialogTitle, 'modal');
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ classdef EDFMGuideComponent < handle
|
||||
%EDFMGUIDECOMPONENT Compatibility adapter from GUIDE/uicontrol to App Designer-style properties.
|
||||
|
||||
properties (Constant, Access = private)
|
||||
NUMERIC_FIELD_TYPE = 'numeric'
|
||||
NumericFieldType = 'numeric'
|
||||
end
|
||||
|
||||
properties (SetAccess = private)
|
||||
@@ -33,11 +33,13 @@ classdef EDFMGuideComponent < handle
|
||||
properties (Access = private)
|
||||
StoredMajorTicks = []
|
||||
StoredMinorTicks = []
|
||||
IsNumericEditField logical = false
|
||||
end
|
||||
|
||||
methods
|
||||
function obj = EDFMGuideComponent(handleObj)
|
||||
obj.Handle = handleObj;
|
||||
obj.IsNumericEditField = obj.detectNumericEditField();
|
||||
end
|
||||
|
||||
function value = get.Value(obj)
|
||||
@@ -62,7 +64,7 @@ classdef EDFMGuideComponent < handle
|
||||
if obj.isNumericEditField()
|
||||
value = str2double(string(get(obj.Handle, 'String')));
|
||||
if isnan(value)
|
||||
value = [];
|
||||
value = NaN;
|
||||
end
|
||||
else
|
||||
raw = get(obj.Handle, 'String');
|
||||
@@ -280,8 +282,12 @@ classdef EDFMGuideComponent < handle
|
||||
end
|
||||
|
||||
function tf = isNumericEditField(obj)
|
||||
tf = obj.IsNumericEditField;
|
||||
end
|
||||
|
||||
function tf = detectNumericEditField(obj)
|
||||
userData = get(obj.Handle, 'UserData');
|
||||
tf = isstruct(userData) && isfield(userData, 'Type') && strcmp(userData.Type, obj.NUMERIC_FIELD_TYPE);
|
||||
tf = isstruct(userData) && isfield(userData, 'Type') && strcmp(userData.Type, obj.NumericFieldType);
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user