typestar

Tabs in Igor Pro

A tab control is one control plus the discipline of hiding the other pages yourself.

Function AddTabs()
    TabControl pages, pos={8, 8}, size={300, 200}, proc=TabChanged
    TabControl pages, tabLabel(0)="Data", tabLabel(1)="Fit", value=0
End

Function TabChanged(STRUCT WMTabControlAction &tca) : TabControl
    if (tca.eventCode != 2)
        return 0
    endif

    Variable page = tca.tab
    Button runBtn, win=$tca.win, disable=(page == 0 ? 0 : 1)
    SetVariable thrSet, win=$tca.win, disable=(page == 1 ? 0 : 1)
    return 0
End

How it works

  1. TabControl draws the tabs; it does not move anything.
  2. The action gets the new tab, and you set disable on each page's controls.
  3. Naming controls by page makes that loop short.

Keywords and builtins used here

The run, in numbers

Lines
15
Characters to type
412
Tokens
117
Three-star pace
85 tpm

At the three-star pace of 85 tokens a minute, this run takes about 83 seconds.

Type this snippet

Step 3 of 4 in Bigger controls, step 11 of 18 in Panels & GUI.

← Previous Next →