Menu Panels and Dialog Boxes

 

DADiSP Menu Panels and Dialog Boxes are the most effective methods of prompting the user for multiple pieces of information during a command file. Menus and dialog boxes allow you to prompt for combinations of real values, integer values, strings, and Window numbers or series. Custom menus can also include help messages. See Chapter 4, "Creating DADiSP Menus", for information on creating menu panels and dialog boxes.

 

When using panel menus or dialog boxes to acquire user input during a command file, you need to include an @SUSPEND to suspend execution of the command file. If you include the @SUSPEND in the command file right after the MENUFILE call, the menu will be displayed, and the execution of the command file will halt until the specified key (usually the OK or CANCEL button) is pressed.

 

The following command file demonstrates the use of a menu panel to query for user input:

 

! MenuPan.dsp

@POP("p1",-1,-1,

"

This command file displays a dialog box, 

waits for the user to fill in the required 

information, and generates the specified  

waveform in the window. 

")

@PAUSE(10)

@UNPOP("p1")

menufile("dialog.pan") @CR

@SUSPEND("@CR @ESC @OK @CANCEL")

MESSAGE("Note","The command file halted until the OK or Cancel button was pressed.",3) @CR

@RETURN

 

Here is the panel menu, Dialog.pan, that is called by the above command file, MenuPan.dsp. It can be created in any text editor.

 

! Dialog.pan -- Generate a Specific Waveform

@panel

Select Function to Generate

 

Waveform: < >~_DEFSIG(strcat("'","<{_SIG}>","'"))~<SQRWAVE><TRIWAVE><EXP>

Length: < >~_DEFPTS(strcat("'","<{_PTS}>","'"))~_ININT("Number of Points") 

Spacing: < >~_DEFSPC(strcat("'","<{_SPC}>","'"))~_INREAL("Sample Interval") 

 

Destination: W< >~defmacro("_dwin",strcat("W","<{getwnum}>"),2)~input(2,1,numwin) 

 

~_MC | eval(strcat("SETWF(",_dwin,",'G",_SIG,"(",_PTS,",",_SPC,",1,0)')"))