CLIM mail archive

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

Utilities



    Date: Wed, 7 Nov 90 03:22 PST
    From: Mabry Tyson <TYSON@sunset.ai.sri.com>
    
    It's not a whole lot of code, and it sure ain't elegant.  But if someone else
    out there has been bashing their heads against the wall on this, I'm willing
    to put the code out for view. (< 15K bytes)
    
Anything you haven't already run by us I'd be happy to see.
    
    Some things I still need to figure out how to do:  
      Have the toplevel loop read a command or a form.

We have both COMMAND and EXPRESSION presentation types, but the
0.9 release doesn't have the OR type.  That's being worked on.

      Bind globals around the toplevel loop

Write an around method for CLIM:RUN-FRAME-TOP-LEVEL.

      Have the cursor be visible in an application frame.

Get your hands on the stream whose cursor you want to be visible
and do 

(setf (ci::cursor-visibility (ci::stream-text-cursor stream)) ':off) [sic]

.  There will probably be some turds left behind as the cursor
moves around, that's why the cursor stuff is still internal.

      Various presentation types (MEMBER-SEQUENCE, TOKEN-OR-TYPE, ...)
    	...and more
    
TOKEN-OR-TYPE suffers for basically the same reason that
COMMAND-OR-FORM doesn't exist: no OR presentation type yet.

Here's a simple implementation of MEMBER-SEQUENCE:

You can say (accept '(member-sequence #(one two three))), for example.

[in the CLIM-INTERNALS package, by the way]

(define-presentation-type member-sequence (&optional choices)
  :object-validator ((object)
		     (not (null (find object choices))))
  :parser ((stream &key default)
	   (multiple-value-bind (object success string)
	       (completing-from-suggestions (stream)
		 (doseq (choice choices)
		   (suggest (token-element-string choice) choice)))
	     (cond ((and object success)
		    object)
		   ((string-equal string "") default)
		   (t (input-not-of-required-type stream object 'member)))))
  :printer ((object stream &key acceptably) acceptably
	    (write-string (token-element-string object) stream))
  :accept-values-displayer ((stream object query-identifier)
			    (flet ((highlighter (continuation object stream)
					 (with-text-face (:bold stream)
					   (funcall continuation object stream)))
				       (selector (a ignore)
					 a))
			      (declare (dynamic-extent #'highlighter #'selector))
			      (genera-accept-values-choose-from-sequence 
				stream choices
				#'decode-alist-member-object
				object
				#'eql 
				type ;; shouldn't TYPE be in the arglist somewhere?
				query-identifier
				#'selector
				#'highlighter)))
  )    

0,,

References:

Main Index | Thread Index