function callbackTunerSelect(blkh)
% CALLBACKTUNERSELECT auto commits changes to the Tuner Method popdown if
% the dialog does not have previously unapplied changes
%
%   blkh: the masked subsystem handle of the PID 1dof or 2dof block
%   autoApply: logical input for if the change to popdown should be
%              automatically comitted

%   Author(s): Aaron Zimmerman
%   Copyright 2017-2020 The MathWorks, Inc.

blkObj = get_param(blkh, 'Object');
hDialog = blkObj.getDialogSource.getOpenDialogs;
autoApply = ~isempty(hDialog) && ~hDialog{1}.hasUnappliedChanges;

% auto commit if block dialog is not dirty
if autoApply
    hDialog{1}.apply();
end
