File MIES_ProgrammaticGUIControl.ipf

PGC Control GUI controls from code

Prototype functions for #PGC_SetAndActivateControl

variable PGC_ButtonControlProcedure(WMButtonAction *ba)
variable PGC_PopupActionControlProcedure(WMPopupAction *pa)
variable PGC_CheckboxControlProcedure(WMCheckBoxAction *cba)
variable PGC_TabControlProcedure(WMTabControlAction *tca)
variable PGC_SetVariableControlProcedure(WMSetVariableAction *tca)
variable PGC_SliderControlProcedure(WMSliderAction *sla)
variable PGC_ListBoxControlProcedure(WMListBoxAction *lba)

Functions

static variable PGC_ShowControlInTab(string win, string control)

Bring all tabs which hold the control to the front (recursively).

Requires that these are managed by ACL_TabUtilities.ipf.

static string PGC_GetProcAndCheckParamType(string recMacro)
variable PGC_SetAndActivateControlStr(string win, string control, string str)

Wrapper for PGC_SetAndActivateControl()

variable PGC_SetAndActivateControlVar(string win, string control, variable var)

Wrapper for PGC_SetAndActivateControl()

variable PGC_SetAndActivateControl(string win, string control, variable val = defaultValue, string str = defaultValue, variable switchTab = defaultValue, variable mode = defaultValue, variable eventCode = defaultValue)

Set the control’s value and execute the control procedure of the given control.

The function tries to mimick interactive operation as closely as possible. Therefore interacting with disabled controls results in an assertion. See mode for a way to avoid that.

Button:

  • Event code: 2

Popup Menu:

  • Event code: 2

Checkbox:

  • Event code: 2

Tab:

  • Event code: 2

SetVariable:

  • Event code: 2

  • Both str and val are accepted and converted to the target type. Read-only controls can only be set with mode = PGC_MODE_FORCE_ON_DISABLED.

ValDisp:

  • Setting this control always changes its mode from ‘internal number’ to ‘global expression’

Slider:

  • Event code: 1

ListBox:

  • Event code: 3

  • The value val is used as row index for writing into the first column of the selection wave (when present), pass LISTBOX_CLEAR_SELECTION to clear the selection in all rows.

  • Column is fixed to 0

Parameters:
  • win – window name or path, when referring to subwindows in a window hierarchy a full subwindow specification with # is required

  • control – GUI control

  • val – [optionality depends on control type] Numeric value to set

  • str – [optionality depends on control type] String value to set

  • switchTab – [optional, defaults to false] Switches tabs so that the control is shown

  • mode – [optional, defaults to PGC_MODE_ASSERT_ON_DISABLED] One of PGC_MODES. Allows to fine tune the behaviour for disabled controls.

  • eventCode – [optional, see below for the defaults] Event code to send PopupMenus:

    • Only one of val or str can be supplied

    • val is 0-based

    • str must be the name of an entry, can include * using wildcard syntax.

Returns:

1 if the numeric value was modified by control limits, 0 if not (only relevant for SetVariable controls)