home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-12-22 | 2.0 KB | 78 lines | [TEXT/ttxt] |
- \ More Mac like alternative to abort"
- \ 8/21/86 cdn for Yerk v2.0
-
- :Module AlertMod
-
- :CLASS Alert <Super X-Array
- int resID
- int type \ 0=caution, 1=note, 2=stop
-
- ( -- ) ( display the alert and execute the item )
- :M SHOW: word0 int: resID 0 get: type
- CASE
- 0 OF call cautionALert ENDOF
- 1 OF call noteAlert ENDOF
- 2 OF call stopAlert ENDOF
- drop call Alert 0
- ENDCASE
- i->l dup 0>
- IF 1- exec: super
- ELSE drop
- THEN ;M
-
- :M INIT: put: type put: resid ;M
-
- \ ( resID type -- ) Combined actions of init: & show:
- :M DISP: init: self show: self ;M
-
- ;CLASS
-
- 0 Variable tALRT here +base tALRT !
- \ t,l,b,r,resID,stage attrs
- 100 w, 51 w, 191 w, 462 w, 0 w, $ 7fff w,
-
- 0 Variable tDITL here +base tDITL !
- 2 w, \ # items-1
- \ placeholder,t,l,b,r,attrs,length,data
- 0, 58 w, 177 w, 80 w, 234 w, 4 c, 2 c, 'type ..OK w,
- 0, 60 w, 355 w, 81 w, 393 w, 136 c, 4 c, 'type 0000 ,
- 0, 10 w, 76 w, 42 w, 393 w, 136 c,
-
- 3 Alert Alrt
-
- \ ( RC type str255 -- ) Display alert using message saved in-line
- : (Al") { RC type Astr -- }
- \ RC \ Display the Alert if code is non-zero
- \ IF \ build ALRT from scratch
- 12 newHandle
- dup 'type ALRT word0 nullOSstr call AddResource
- >ptr tALRT 4+ swap 12 cMove
- \ build DITL from scratch
- Astr dup c@ align 50 + newHandle
- dup 'type DITL word0 nullOSstr call AddResource
- tDITL 36 + 4 blanks
- RC s->d swap over dabs <# #s sign #> tDITL 36 + swap 4 min cMove
- >ptr tDITL 4+ over 49 cMove
- 49 + over c@ 1+ cMove
- arrowcurs
- 0 type disp: alrt
- 0 GetRes ALRT dup call RmveResource call ReleaseResource
- 0 GetRes DITL dup call RmveResource call ReleaseResource
- type 0 max 3 min exec: Aact
- \ THEN
- ;
-
- : three 3 ;
-
- 4 alert me
-
- \ text is last, there can be up to 4 buttons. Each button will return
- \ its number. The first item should be the default button requiring no
- \ action - a zero is returned.
- 4 'cfas three 2 1 0 0 to: me 1 to: me 2 to: me 3 to: me
-
- : alert! init: me arrowcurs show: me ;
-
-
- ;Module
-