Lisp HUG Maillist Archive

No "Yes" please

Hi LispWorkers,

My "tunnel vision" is acting up again, having stared at this too
long. My intent was to display a YES/NO choice with neither of the
choices selected (yet). Can't find an initarg which achieves this in a
RADIO-BUTTON-PANEL - which seems reasonable for radio button behaviour.
So how about a CHECK-BUTTON-PANEL with :single-selection as it's
:interaction?  All that gives me (in effect and appearance) is another
RADIO-BUTTON-PANEL and the same problem I started with.

It should be possible to disable the default selection of "Yes", no?     :^)



(in-package "CL-USER")


(defvar *initargs-alist*
  '((:default-button nil)
    (:initial-focus nil)
    (:initial-focus-item nil)
    (:selected-item nil)
    (:selected-items nil)
    (:selection nil))
  "One of these initargs leaves no button selected?")


;; RADIO-BUTTON-PANEL
(defclass rad (capi:radio-button-panel) ()
  (:default-initargs
   :items '(:yes :no)))


;; CHECK-BUTTON-PANEL
(defclass chk (capi:check-button-panel) ()
  (:default-initargs
   :interaction :single-selection
   :items '(:yes :no)))



#| Display Radio button panels using the different initargs
(mapc
 #'(lambda (initarg)
        (let ((initarg (car initarg))
              (val (cadr initarg)))
          (capi:contain
            (make-instance 'rad
                           :title (format nil "~A = ~A" initarg val)
                           initarg val))))
 *initargs-alist*)
|#


#| Display Check button panels using the different initargs
(mapc
 #'(lambda (initarg)
        (let ((initarg (car initarg))
              (val (cadr initarg)))
          (capi:contain
            (make-instance 'chk
                           :title (format nil "~A = ~A" initarg val)
                           initarg val))))
 *initargs-alist*)
|# 


Re: No "Yes" please

> It should be possible to disable the default selection of
> "Yes", no?     :^)

Create your own panel with "capi:radio-button"s to make the behavior you want?

Best,
 Art


Re: No "Yes" please

Also, try this (but not sure if this is a corret way to hack):

(in-package "CL-USER")

(defvar *initargs-alist*
  '((:default-button nil)
    (:initial-focus nil)
    (:initial-focus-item nil)
    (:selected-item nil)
    (:selected-items nil)
    (:selection nil))
  "One of these initargs leaves no button selected?")

(defclass rad (capi:radio-button-panel) ()
  (:default-initargs
   :items '(:yes :no)))

(mapc #'(lambda (initarg)
          (let* ((arg (car initarg))
                 (val (cadr initarg))
                 (rad (make-instance 'rad
                                     :title (format nil "~A = ~A" arg val)
                                     arg val)))
            (setf (capi:choice-selection rad) nil)
            (capi:contain rad)))
      *initargs-alist*)


Re: No "Yes" please


>> It should be possible to disable the default selection of
>> "Yes", no?     :^)
>

Please ignore my original post. (ie. "post-haste!")

I can of course achieve what I need with an INITIALIZE-INSTANCE
method. I was stuck in a mindset the initarg should do what I want immediately; but
tweaking INITIALIZE-INSTANCE is trivial.

Moral of story: too many beerz, too little CAPI.   :^o

BC


Updated at: 2020-12-10 08:39 UTC