Panels & GUI
18 steps in 5 sets of Igor Pro.
Igor procedures often end up as tools for other people in the lab, and that means a control panel. NewPanel, buttons and the WMButtonAction structure they hand you, group boxes, and then the controls that hold a value: SetVariable, popups, checkboxes, sliders.
The larger controls come next, including listboxes backed by waves, ValDisplay, tabs, and building controls at run time when you do not know how many you need. Wiring it up is the last set: ControlInfo, disabling things, window hooks, Prompt and DoPrompt for a quick dialog, and Menu blocks so your tool appears where people look for it.
A panel
- A control panelNewPanel opens a window that holds controls instead of data.
- ButtonsA button names the function it calls, and that function receives a structure.
- Grouping controlsA GroupBox is a frame with a title, and it is how a busy panel stays readable.
Values a user sets
- Numbers and text a user can editSetVariable binds a control to a global, so the value outlives the click.
- Reacting to an editA SetVariable action fires on every kind of change, so check which one you got.
- Popup menusA popup's list can be a literal string or an expression evaluated when it opens.
- Checkboxes and radio buttonsThe same control does both: a shared mode makes a group exclusive.
- SlidersA slider is a SetVariable you can drag, and it reports continuously unless told not to.
Bigger controls
- ListboxesA listbox is backed by waves: one for the text, one for the selection.
- Showing a value backValDisplay is read-only, and its value can be an expression that re-evaluates.
- TabsA tab control is one control plus the discipline of hiding the other pages yourself.
- Controls made at run timeA control is created by a command, so a panel can build itself from the data.
Wiring it up
- Reading a controlControlInfo asks a control what it holds, without keeping a copy yourself.
- Enabling and disablingEvery control takes disable, and using it is how a panel explains itself.
- Window hooksA hook function sees what happens to the window itself, not to one control.
- A dialog without a panelPrompt plus DoPrompt is a whole dialog in six lines, and it needs no window.
- MenusA Menu block adds items to Igor's own menus, and each item names a call.
Encore
- control_panel.ipfA working panel: globals, controls, actions, and a hook that clears up after itself.