Controls

You can add many kinds of controls to Igor´s control panels or graphs and implement their behavior by writing "control procedures" for them.

The Add/Modify Control dialog makes this relatively simple. Select the graph or panel you want to add the control to, and choose "Add Control" from the Graph or Panel menu:

graph with empty panel area above

Set up the control's size and other properties using the dialog:

Create Slider Dialog, with New button to create a slider procedure

Click on the New (Procedure) button to add code which will execute when the slider is set to a new value:

Slider procedure dialog with skeleton code and user-provided code

A skeleton procedure is created for you. Add your custom code in this dialog or afterwards in the procedure window. Here we´ve added only the value set code which re-computes a single-tone audio wave whose frequency is controlled by the slider value as a percentage of the 44100 Hz sampling frequency. The remaining text is the structure-based skeleton code for a slider control.

Click on Save Procedure Now, then click Do It in the main dialog to create the slider control:

Completed slider control in panel area above graph

Move the slider´s thumb to see how the slider´s procedure changes the data array:

graph shows sine wave whose frequency is controlled by slider setting

Other standard controls can be added using dialogs:

Examples of standard controls: buttons, checkboxes, radio buttons, popup menus, a slider, set variable, value display, list box, and a FIFO

Once created the controls can be arranged by dragging, by copy-and-paste, or by contextual menus that align, distribute or even retrieve controls that stray beyond the window´s bounds:

two mis-aligned radio buttons selected, the Mover contextual menu is shown with the "Align->Left Edges" menu item about to be chosen
the left edges of the two radio buttons are shown aligned

Help for Controls

You can add contextual help tips to explain the controls to your users by entering Help Text in the control dialogs:

example of help text being displayed near a user-created control

Another way to provide help is to create a Help button that opens an Igor Help File (that you´ve created) using the DisplayHelpTopic command:

code that runs when the Help button is clicked shows the Help button and the help file that is displayed when the button is clicked