Setting the Enable or Visible State

 

The e display area modifier enables or disables a control while the v modifies shows or hides a control. The enabled or visible state of control can be changed by dynamically updating a dialog box.

 

The previously presented enable1.pan dialog box dynamically disables the Remove DC Offset checkbox option when the Gnormal option is selected.

 

         

 

 

// enable1.pan - enable/disable control

@dialog

 

// initialize parameters

{defvar("gfunc", "Grandom");defvar("nodc", 1)}

 

// checkbox enabled

{setvar("chkbox", gfunc=="Grandom")}

 

Generate Noise

 

Generate Function <# r w=20>~gfunc = "<{gfunc}>"~<Grandom><Gnormal>

Remove DC Offset  <c e={chkbox}>~nodc=<{nodc}>~<0><1>

<L>

~menuclear

~genfunc = sprintf("%s(100, 1/100)", gfunc)

~if(nodc && chkbox, setwf(sprintf("demean(%s)", genfunc)), setwf(genfunc))

 

 

Simply changing the e modifier to v, the checkbox control becomes hidden when Gnormal option is selected.

 

// visable1.pan - show/hide control

@dialog

 

// initialize parameters

{defvar("gfunc", "Grandom");defvar("nodc", 1)}

 

// checkbox visible

{setvar("chkbox", gfunc=="Grandom")}

 

Generate Noise

 

Generate Function <# r w=20>~gfunc = "<{gfunc}>"~<Grandom><Gnormal>

Remove DC Offset  <c v={chkbox}>~nodc=<{nodc}>~<0><1>

<L>

~menuclear

~genfunc = sprintf("%s(100, 1/100)", gfunc)

~if(nodc && chkbox, setwf(sprintf("demean(%s)", genfunc)), setwf(genfunc))

 

 

         

 

Hidden or disabled control are not evaluated when the dialog box is processed by pressing the OK button.