Tabbed Dialog Boxes

 

A tabbed dialog box is a group of dialog boxes presented together, where only one dialog box visible and accessible at a time.  Other dialog boxes in the tabbed dialog panel are brought to the foreground by clicking on their associated tabs. A tabbed dialog box organizes and displays a group related functions for the user.  

 

The @tabbed option to specifies a tabbed dialog box.  The tabbed dialog box menu file contains a list of calls to the MENUFILE function (or a variant such as _menuf)  with the filenames of each individual dialog box to appear in the tabbed dialog box.  Each of these calls follows a tilde (~) character.  The text that appears on the tab in a tabbed dialog box is obtained from the files for each individual dialog; it is the text that would normally appear as the menu title. Statements that follow two tildes, ~~, execute after the OK button has been pressed and after each tab has been processed.

 

By convention, a tabbed dialog box uses the .tab extension. Here is an example of a tabbed dialog box:

 

// tabbed.tab - tabbed dialog box

@tabbed

 

Tabbed Dialog Box

 

~_menuf("gen.pan")

~_menuf("units.pan")

 

// statements to execute on OK

~~unitfun = sprintf("setvunits('%s');sethunits('%s')", vunits, hunits);

~~if(_chkwin > 0, eval(sprintf('setwf(%s, "%s;%s")', _dwin, gfunc, unitfun)))

 

Here are the menu files for each tab:

 

// gen.pan - generate data

@dialog

 

// default values

{defvar("dist", 0);defvar("len", 100);defvar("dx", 0.01)}

 

Generate Random Data

Distribution <r n>~dist = <{dist}>~<Uniform><Normal>

Length:      <w=20>~len = <{len}>~input(2)

Delta X:     <w=20>~dx  = <{dx}>~input(1)

<L>

{_dwinstrS("w=20")}

~_verifydlen

~if(dist==0, gfunc = "Grandom", gfunc = "Gnormal")

~gfunc = sprintf("%s(%d, %g)", gfunc, len, dx)

 

// units.pan - assign units

@dialog

 

// default units to system defaults

{defvar("vunits", _getvunits);defvar("hunits", _gethunits)}

 

Units

<>

(Y) Vertical Units:   <* w=20>~vunits="<{vunits}>"~_unitslist

(X) Horizontal Units: <* w=20>~hunits="<{hunits}>"~_unitslist

<L>

 

 

 

The gen.pan and units.pan dialog boxes appear as tabs of the tabbed dialog box but operate almost identically as a stand-alone dialog boxes. The individual dialog boxes are initialized as normal and when the OK button is pressed, the execution statements for each dialog box are evaluated as normal.

 

In this example, the gen.pan tab creates a variable gfunc that contains the random noise function as a string.

 

The units.pan tab creates the hunits and vunits strings that contains the desired units for the generated series. The _getvunits and _gethunits system macros return the default y and x units for a series and the _unitslist system macro returns a list of available units.

 

When the OK button is pressed, the tabbed.tab parent dialog combines the strings created by the tabs into a master formula that generates the data and assigns the units.

 

 

 

Design Suggestions for Tabbed Dialog Boxes

 

The advantage of a tabbed dialog box is that it allows a group related functions and information to display in one location, making it easier for the user to work while minimizing mouse clicks and navigation.  However, too many tables or too much information in a tabbed dialog box can be overwhelming.  Although DADiSP imposes no limit, try to limit the number of tabs to one or two rows.  

 

Use concise menu titles, as the length of text appearing in the individual menu panels as the dialog box title determines the length of the tab for that particular menu.

 

Tabbed dialog boxes are sized to the largest of the individual tabs generated by the tabbed dialog.  If one tab is significantly larger than the others, the smaller tabs will contain excess “white space”.  Consider how to group functions to optimize sizing concerns.

 

Finally, testing the individual dialog box menu files prior to testing the tabbed dialog box will simplify the debug process.