CLIM mail archive

[Prev][Next][Index][Thread]

accepting-values



    Date: Tue, 1 Sep 1992 17:53 EDT
    From: "Robin Kladke (303-977-9760" <robin@jarrett.den.mmc.com>

    I am having some infuriating problems with clim:accepting-values.  I'm not
    sure what version i am running, but it is the one that comes with Genera 8.1.

    I am trying to pop up a simple dialog box each time my program receives
    an Operator Information Message from the outside.  The box will contain
    the source of the message, the message, and must accept a response string,
    if the message indicates that a response is required.  If no response is
    required, the operator will simply select OK or EXIT and the popup window
    should go away.   If a response is required, the user MUST supply a string
    response (i don't care what he responds, but at least one character would
    be required) then pick OK.  THe response message will then be sent to the
    source.

    My problems are two-fold:  
    (1) I would like to use :own-window, but don't know what to use for stream.
    You must provide stream as the first argument and *query-io*, t, etc. don't
    work (no method error).  I finally used the root window as stream.  That
    worked, but i don't know if it is the *correct* way.

Using the root window is a bit of a hack, but in CLIM 1.0/1.1 it's
really perfectly OK to do so.

    (2) ABORT is NEVER an acceptable response to this window; how do i define
    accepting-values so that it will only print one exit box?  I've tried
    defining only :exit in the :exit-boxes option, i've tried defining the
    string associated with :abort as NIL, all to no avail.  How do i get rid
    of ABORT?
    -- the only solution i've come up with is to redisplay the popup if abort
    is chosen, but this is a major yucky solution.

In CLIM 1.0/1.1, you're sort of stuck (but see below).  In CLIM 2.0, the
:EXIT-BOXES option to ACCEPTING-VALUES does the right thing.

In CLIM 1.0/1.1, you could specialize this method for your own class of
ACCEPT-VALUES, and then use the :FRAME-CLASS option to ACCEPTING-VALUES.

(defmethod display-exit-boxes ((frame accept-values) stream)
  ;; Do the fresh-line *outside* of the updating-output so that it
  ;; doesn't get repositioned relatively in the X direction if the
  ;; previous line gets longer.  Maybe there should be some better
  ;; way of ensuring this.
  (fresh-line stream)
  (with-slots (exit-boxes) frame
    (let ((exit  (or (second (assoc :exit  exit-boxes)) "<End> uses these values"))
	  (abort (or (second (assoc :abort exit-boxes)) "<Abort> aborts")))
      (updating-output (stream :unique-id stream
			       :cache-value 'exit-boxes)
	(with-output-as-presentation (:stream stream
				      :type 'accept-values-exit-box
				      :object ':abort)
	  #-CCL-2 (write-string abort stream)
          ;; Kludge to print the cloverleaf char in MCL.
          ;; Needs an accompanying kludge in STREAM-WRITE-CHAR so that
          ;; #\CommandMark doesn't get lozenged.
          #+CCL-2 (progn
                    (with-text-style ('(:mac-menu :roman :normal) stream)
                      (write-char #\CommandMark stream))
                    (write-string "-. aborts" stream)))
	(write-string ", " stream)
	(with-output-as-presentation (:stream stream
				      :type 'accept-values-exit-box
				      :object ':done)
	  (write-string exit stream))))))

    --Robin

0,,

References:

Main Index | Thread Index