Structured System variables -- ^$WINDOW

Window attributes
Gadget attributes
Choice attributes
Event attributes
Event information


^$W[INDOW]

Introduced in the 1995 ANSI M[UMPS] Windowing Application Programmer's Interface standard.

This structured system variable provides information about the windows that are currently known to the M[UMPS] process.

Most of the examples below will use this window:

[ graphic to be inserted later ]

which is defined in the global variable ^BURGER as:

^BURGER("MESSAGE","G","OK","EVENT","SELECT")="POPUP^BURGER"
^BURGER("MESSAGE","G","OK","POS")="50,5"
^BURGER("MESSAGE","G","OK","SIZE")="100,30,PIXEL"
^BURGER("MESSAGE","G","OK","TITLE")="OK"
^BURGER("MESSAGE","G","OK","TYPE")="BUTTON"
^BURGER("MESSAGE","G","TEXT","CANCHANGE")=0
^BURGER("MESSAGE","G","TEXT","POS")="5,2"
^BURGER("MESSAGE","G","TEXT","TYPE")="TEXT"
^BURGER("MESSAGE","MODAL")="PARENT"
^BURGER("MESSAGE","PARENT")="ORDER"
^BURGER("MESSAGE","POS")="12,0"
^BURGER("MESSAGE","RESIZE")=0
^BURGER("MESSAGE","SIZE")="60,7"
^BURGER("MESSAGE","UNITS")="CHAR"
^BURGER("MESSAGE","VISIBLE")=0

^BURGER("ORDER","G","BURGER","EVENT","CHANGE")="TOTAL^BURGER"
^BURGER("ORDER","G","BURGER","POS")="240,160"
^BURGER("ORDER","G","BURGER","SIZE")="110,25"
^BURGER("ORDER","G","BURGER","TITLE")="Burger  $1.00"
^BURGER("ORDER","G","BURGER","TYPE")="CHECK"
^BURGER("ORDER","G","CUSTOMER","CHARMAX")=60
^BURGER("ORDER","G","CUSTOMER","EVENT","CHANGE")="CUST^BURGER"
^BURGER("ORDER","G","CUSTOMER","POS")="140,30"
^BURGER("ORDER","G","CUSTOMER","SIZE")="220,25"
^BURGER("ORDER","G","CUSTOMER","TITLE")="Customer Name:"
^BURGER("ORDER","G","CUSTOMER","TPOS")="LEFT"
^BURGER("ORDER","G","CUSTOMER","TYPE")="TEXT"
^BURGER("ORDER","G","DRINKS","CHOICE",1)="Coke         $0.75"
^BURGER("ORDER","G","DRINKS","CHOICE",2)="Pepsi        $0.70"
^BURGER("ORDER","G","DRINKS","CHOICE",3)="Orange       $0.50"
^BURGER("ORDER","G","DRINKS","CHOICE",4)="Water        $0.00"
^BURGER("ORDER","G","DRINKS","CHOICE",5)="Root Beer    $0.50"
^BURGER("ORDER","G","DRINKS","CHOICE",6)="Sprite       $0.50"
^BURGER("ORDER","G","DRINKS","CHOICE",7)="Bass Ale     $3.50"
^BURGER("ORDER","G","DRINKS","CHOICE",8)="Meisterbrau  $3.50"
^BURGER("ORDER","G","DRINKS","CHOICE",9)="Budweiser    $1.50"
^BURGER("ORDER","G","DRINKS","CHOICE",10)="Red Wine     $2.50"
^BURGER("ORDER","G","DRINKS","CHOICE",11)="White Wine   $2.50"
^BURGER("ORDER","G","DRINKS","CHOICE",12)="Pink Wine    $1.75"
^BURGER("ORDER","G","DRINKS","POS")="40,120"
^BURGER("ORDER","G","DRINKS","SIZE")="140,140"
^BURGER("ORDER","G","DRINKS","TITLE")="Drinks"
^BURGER("ORDER","G","DRINKS","TYPE")="LIST"
^BURGER("ORDER","G","DRINKS","VALUE",4)=""
^BURGER("ORDER","G","FRIES","EVENT","CHANGE")="TOTAL^BURGER"
^BURGER("ORDER","G","FRIES","POS")="240,130"
^BURGER("ORDER","G","FRIES","SIZE")="110,25"
^BURGER("ORDER","G","FRIES","TITLE")="Fries        $0.50"
^BURGER("ORDER","G","FRIES","TYPE")="CHECK"
^BURGER("ORDER","G","ORDER","EVENT","SELECT")="ORDER^BURGER"
^BURGER("ORDER","G","ORDER","POS")="280,280"
^BURGER("ORDER","G","ORDER","SIZE")="60,25"
^BURGER("ORDER","G","ORDER","TITLE")="Order"
^BURGER("ORDER","G","ORDER","TYPE")="BUTTON"
^BURGER("ORDER","G","PIE","EVENT","CHANGE")="TOTAL^BURGER"
^BURGER("ORDER","G","PIE","POS")="240,190"
^BURGER("ORDER","G","PIE","SIZE")="110,25"
^BURGER("ORDER","G","PIE","TITLE")="Pie          $0.50"
^BURGER("ORDER","G","PIE","TYPE")="CHECK"
^BURGER("ORDER","G","TOTAL","POS")="40,280"
^BURGER("ORDER","G","TOTAL","SIZE")="100,40"
^BURGER("ORDER","G","TOTAL","TITLE")="Total: $ 0.00"
^BURGER("ORDER","G","TOTAL","TYPE")="LABEL"
^BURGER("ORDER","M","MENU1","CHOICE",1)="Options"
^BURGER("ORDER","M","MENU1","CHOICE",1,"SUBMENU")="MENU2"
^BURGER("ORDER","M","MENU2","CHOICE",1)="Clear"
^BURGER("ORDER","M","MENU2","CHOICE",1,"EVENT","SELECT")="CLEAR^BURGER"
^BURGER("ORDER","M","MENU2","CHOICE",2)="Exit"
^BURGER("ORDER","M","MENU2","CHOICE",2,"EVENT","SELECT")="EXIT^BURGER"
^BURGER("ORDER","MENUBAR")="MENU1"
^BURGER("ORDER","POS")="20,30"
^BURGER("ORDER","RESIZE")=0
^BURGER("ORDER","SIZE")="400,400"
^BURGER("ORDER","TITLE")="Fast Food Order"
^BURGER("ORDER","UNITS")="PIXEL"
^BURGER("ORDER","VISIBLE")=1
^BURGER("ORDER","VISIBLE","TYPE")="CHECK"

and is manipulated by the program:

BURGER ; Written by Thomas Salander,
; after an original by Guy Gardner
;
; Copy the window definition from a global variable
; into the ^$WINDOW structure
;
MERGE ^$WINDOW("ORDER")=^BURGER("ORDER")
;
; Copy the window definition for the message pop-up
; window as well. This window has its 'visible'
; flag off, so that it does not yet appear.
;
MERGE ^$WINDOW("MESSAGE")=^BURGER("MESSAGE")
;
; Start call-back processing
;
ESTART
;
; Return here after handling call-backs.
; Delete windows and terminate program.
;
KILL ^$WINDOW("ORDER"),^$WINDOW("MESSAGE")
QUIT
;
EXIT ; Call-back for exit item in menu
ESTOP
QUIT
;
CLEAR ; Call-back for Clear item in menu
NEW ITEM,T
FOR ITEM="DRINKS","FRIES","BURGER","PIE" DO
. KILL ^$WINDOW("ORDER","G",ITEM,"VALUE")
. QUIT
SET T="Total: $0.00"
SET ^$WINDOW("ORDER","G","TOTAL","TITLE")=T
QUIT
;
CUST ; Call-back for change in Customer Name:
; text gadget
;
NEW VALUE,TXT
SET VALUE=^$WINDOW("ORDER","G","CUSTOMER","VALUE")
QUIT:VALUE=""  ; Nothing selected
QUIT:VALUE?1.A1","1.A  ; All is well
;
; Set up to display the modal message window
; First, change the message
;
SET TXT="Please enter name in form Last,First only."
SET ^$WINDOW("MESSAGE","G","TEXT","VALUE")=TXT
;
; Now display the message window
;
SET ^$WINDOW("MESSAGE","VISIBLE")=1
;
; Now wait for the event
;
ESTART
;
; When we return from this event handler,
; our event data is restored to the state
; it was before the call.
; Since the results are not valid, prevent
; the change of focus.
;
KILL ^$EVENT("OK")
QUIT
;
TOTAL ; Call-back for all check boxes and list box
; When data changes in order...
; used to update the Total
;
NEW WIN,TOT,ITEM,TITLE,D
SET WIN=^$EVENT("WINDOW")
SET TOT=0
;
; Loop through the check-boxes
;
FOR ITEM="FRIES","BURGER","PIE" DO
. QUIT:'^$WINDOW(WIN,"G",ITEM,"VALUE")  ; not on
. SET TITLE=^$WINDOW(WIN,"G",ITEM,"TITLE")
. SET TOT=TOT+$PIECE(TITLE,"$",2) ; add price
. QUIT
;
; If a drink was ordered, add the price
;
SET D="DRINKS"
IF ^$WINDOW(WIN,"G",D,"VALUE") DO
. SET ITEM=$ORDER(^$WINDOW(WIN,"G",D,"VALUE",""))
. SET TITLE=^$WINDOW(WIN,"G",D,"CHOICE",ITEM)
. SET TOT=TOT+$PIECE(TITLE,"$",2) ; add price
. QUIT
;
SET TOT=$JUSTIFY(TOT,0,2)
SET:TOT<1 TOT=0_TOT SET TOT="Total: $ "_TOT
SET ^$WINDOW(WIN,"G","TOTAL","TITLE")=TOT
QUIT
;
ORDER ; Call-back for push button Order
NEW WIN,ITEM,D
SET WIN=^$WINDOW("WINDOW")
;
; Loop through the check-boxes
;
FOR ITEM="FRIES","BURGER","PIE" DO
. QUIT:'^$WINDOW(WIN,"G",ITEM,"VALUE")  ; Not on
. SET ^ORDER($JOB,ITEM)=1
. QUIT
;
; Was a drink ordered?
;
SET D="DRINKS"
SET ITEM=$ORDER(^$WINDOW(WIN,"G",D,"VALUE",""))
IF ITEM DO  ; Yes, a drink was ordered
. SET ITEM=^$WINDOW(WIN,"G",D,"CHOICE",ITEM)
. ; Strip price
. SET ^ORDER($JOB,$PIECE(ITEM," ",1))=1
. QUIT
;
DO CLEAR
QUIT
;
POPUP ; Call-back from the modal message window
SET ^$WINDOW(^$EVENT("WINDOW"),"VISIBLE")=0
ESTOP
QUIT


This document is © Ed de Moel, 1995-2005.
It is part of a book by Ed de Moel that is published under the title "M[UMPS] by Example" (ISBN 0-918118-42-5).
Printed copies of the book are no longer available.

This document describes the various special (system) variables that are defined in the M[UMPS] language standard (ANSI X11.1, ISO 11756).

The information in this document is NOT authoritative and subject to be modified at any moment.
Please consult the appropriate (draft) language standard for an authoritative definition.

In this document, information is included that will appear in future standards.
The MDC cannot guarantee that these 'next' standards will indeed appear.