Main Content

slConfigUISetEnabled

Enable or disable custom target configuration option

Syntax

slConfigUISetEnabled(hDlg,hSrc,'OptionName',true)
slConfigUISetEnabled(hDlg,hSrc,'OptionName',false)

Arguments

hDlg

Handle created in the context of a SelectCallback function and used by the System Target File Callback Interface functions. Pass this variable but do not set it or use it for another purpose.

hSrc

Handle created in the context of a SelectCallback function and used by the System Target File Callback Interface functions. Pass this variable and use it to refresh the Configuration Parameters dialog box. Do not set it or use it for another purpose.

'OptionName'

Quoted name of the TLC variable defined for a custom target configuration option.

true

Specifies that the option should be enabled.

false

Specifies that the option should be disabled.

Description

The slConfigUISetEnabled function is used in the context of a user-written SelectCallback function, which is triggered when the custom target is selected in the System Target File Browser in the Configuration Parameters dialog box. You use slConfigUISetEnabled to enable or disable a specified target option. To refresh the Configuration Parameters dialog, use hSrc.refreshDialog.

If you use this function to disable a parameter that is represented in the Configuration Parameters dialog box, the parameter appears greyed out in the dialog context.

Examples

In the following example, the slConfigUISetEnabled function disables the Configuration Parameters > Code Generation > Interface > Advanced parameters > Terminate function required option.

function usertarget_selectcallback(hDlg,hSrc)

  disp(['*** Select callback triggered:',sprintf('\n'), ...
        '  Uncheck and disable "Terminate function required".']);

  disp(['Value of IncludeMdlTerminateFcn was ', ...
        slConfigUIGetVal(hDlg,hSrc,'IncludeMdlTerminateFcn')]);

  slConfigUISetVal(hDlg,hSrc,'IncludeMdlTerminateFcn','off');
  slConfigUISetEnabled(hDlg,hSrc,'IncludeMdlTerminateFcn',false);
  hSrc.refreshDialog;
Introduced in R2006b