home *** CD-ROM | disk | FTP | other *** search
/ Education Sampler 1992 [NeXTSTEP] / Education_1992_Sampler.iso / Programming / Source / winterp-1.13 / examples / radiobox1.lsp < prev    next >
Encoding:
Lisp/Scheme  |  1991-10-06  |  2.4 KB  |  69 lines

  1. ; -*-Lisp-*-
  2. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3. ;
  4. ; File:         radiobox1.lsp
  5. ; RCS:          $Header: radiobox1.lsp,v 1.2 91/10/05 18:46:49 mayer Exp $
  6. ; Description:  The straighforward way to define a radio box.
  7. ;               See radiobox2.lsp for a better way using a WINTERP-subclassed
  8. ;               toggle-button. Just load this file to see the example.
  9. ; Author:       Niels Mayer, HPLabs
  10. ; Created:      Sat Nov 25 01:22:37 1989
  11. ; Modified:     Sat Oct  5 18:46:33 1991 (Niels Mayer) mayer@hplnpm
  12. ; Language:     Lisp
  13. ; Package:      N/A
  14. ; Status:       X11r5 contrib tape release
  15. ;
  16. ; WINTERP Copyright 1989, 1990, 1991 Hewlett-Packard Company (by Niels Mayer).
  17. ; XLISP version 2.1, Copyright (c) 1989, by David Betz.
  18. ;
  19. ; Permission to use, copy, modify, distribute, and sell this software and its
  20. ; documentation for any purpose is hereby granted without fee, provided that
  21. ; the above copyright notice appear in all copies and that both that
  22. ; copyright notice and this permission notice appear in supporting
  23. ; documentation, and that the name of Hewlett-Packard and Niels Mayer not be
  24. ; used in advertising or publicity pertaining to distribution of the software
  25. ; without specific, written prior permission.  Hewlett-Packard and Niels Mayer
  26. ; makes no representations about the suitability of this software for any
  27. ; purpose.  It is provided "as is" without express or implied warranty.
  28. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  29.  
  30. (setq toplevel_w
  31.       (send TOP_LEVEL_SHELL_WIDGET_CLASS :new 
  32.         :XMN_GEOMETRY "500x500+1+1"
  33.         :XMN_TITLE "Radio-Box-Test #1"
  34.         :XMN_ICON_NAME "Radio-Box-Test #1"
  35.         ))
  36.  
  37. (setq rowcol_w
  38.       (send XM_ROW_COLUMN_WIDGET_CLASS :new :managed :radio_box "rc" toplevel_w
  39.         ))
  40.  
  41. (send toplevel_w :realize)
  42.  
  43. (do* 
  44.  (;; local vars
  45.   (i 0 (1+ i))
  46.   but_w
  47.   (buttons nil)
  48.   )
  49.  (;; test and return
  50.   (eql i 20)
  51.   )
  52.  ;; body
  53.  (setq but_w
  54.        (send XM_TOGGLE_BUTTON_GADGET_CLASS :new :managed rowcol_w
  55.          :XMN_LABEL_STRING (format nil "Button ~A" i)
  56.          ))
  57.  (send but_w :set_callback :xmn_value_changed_callback
  58.        '(callback_widget callback_set)
  59.        '((if callback_set
  60.          (print_set_button callback_widget buttons)
  61.        )))
  62.  (setq buttons (cons (cons but_w i) buttons))
  63.  )
  64.  
  65.  
  66. (defun print_set_button (widget buttons)
  67.   (format T "Selected button ~A\n" (cdr (assoc widget buttons)))
  68.   )
  69.