typestar

A dialog without a panel in Igor Pro

Prompt plus DoPrompt is a whole dialog in six lines, and it needs no window.

Function AskAndRun()
    Variable width = 5
    String method = "binomial"
    String target = ""

    Prompt width, "Smoothing window"
    Prompt method, "Method", popup, "binomial;boxcar;median"
    Prompt target, "Wave", popup, WaveList("*", ";", "")

    DoPrompt "Smooth a wave", width, method, target
    if (V_flag)
        return -1
    endif

    Printf "%s smoothing of %s, window %d\r", method, target, width
    return 0
End

How it works

  1. Each Prompt names a variable and its label, in order.
  2. DoPrompt shows them and sets V_flag to 1 if the user canceled.
  3. A Prompt with a list becomes a popup menu.

Keywords and builtins used here

The run, in numbers

Lines
17
Characters to type
384
Tokens
70
Three-star pace
90 tpm

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

Type this snippet

Step 4 of 5 in Wiring it up, step 16 of 18 in Panels & GUI.

← Previous Next →