From: Jeff Sullivan
Subject: CLIM: keyword paramters for presentation types?
Date: 
Message-ID: <23206@venera.isi.edu>
Hi,

I'm trying to define some graphical presentation types in CLIM 1.0,
and I can't see from the manual how to place the "location"
parameters.

I have a type like "city", and I want to be able to say:

(present current-city 'city
	:stream stream
	:color clim:+red+
	:X 235
	:Y 115
	:orientation 'vertical)

The problem is, I can't see form any of the examples, how to add the
keyword arguments to the defintion:

(clim:define-presentation-method clim:present
    (city (type city) stream (view clim:textual-view)
	&key color x y orientation)
...

This doesn't work, as I get an error from CLIM:

>>Error: Call to #<Compiled-Function CLIM:PRESENT 73197E> has extra 
keyword :COLOR

(Any change in params results in the first keyword giving the error,
so it's not that COLOR was ill-defined).

Is it possible to do what I want?

Also, I'm using CLIM:TEXTUAL-VIEW because it's the only
presentation-type I know of, but I really should be defining a
GRAPHICAL-VIEW for this shouldn't I?  How is this done?  The manual is
rather obtuse on this matter.

jas


--
--------------------------------------------------------------------------
Jeffrey A. Sullivan             | Research Scientist et al.
···@isi.edu (Internet)          | Information Sciences Institute
72511,402    (Compuserve)       | University of Southern California

From: Barry Margolin
Subject: Re: CLIM: keyword paramters for presentation types?
Date: 
Message-ID: <1j467nINNot8@early-bird.think.com>
You're probably better off asking CLIM questions on the ····@bbn.com
mailing list.  I'm not a CLIM expert, and I'm basing my response on
knowledge of Dynamic Windows, on which CLIM is based, and which I believe
is very similar in the area of your question.

In article <·····@venera.isi.edu> ···@ISI.EDU (Jeff Sullivan) writes:
>I'm trying to define some graphical presentation types in CLIM 1.0,
>and I can't see from the manual how to place the "location"
>parameters.
>
>I have a type like "city", and I want to be able to say:
>
>(present current-city 'city
>	:stream stream
>	:color clim:+red+
>	:X 235
>	:Y 115
>	:orientation 'vertical)
>
>The problem is, I can't see form any of the examples, how to add the
>keyword arguments to the defintion:

Presentation options are specified in DEFINE-PRESENTATION-TYPE, and you
include them in the presentation type specifier when you call PRESENT.  For
example:

(clim:define-presentation-type city ()
  :options (color x y orientation)
  ...)

(present current-city '((city) :color clim:+red+ :x 235 :y 115
			       :orientation 'vertical))

Your presentation method can then access the variables COLOR, X, Y, and
ORIENTATION.
-- 
Barry Margolin
System Manager, Thinking Machines Corp.

······@think.com          {uunet,harvard}!think!barmar
From: Randy Coulman
Subject: Re: CLIM: keyword paramters for presentation types?
Date: 
Message-ID: <1j4r1vINNppd@access.usask.ca>
In article <·····@venera.isi.edu>, ···@ISI.EDU (Jeff Sullivan) writes:
>
>Hi,
>
>I'm trying to define some graphical presentation types in CLIM 1.0,
>and I can't see from the manual how to place the "location"
>parameters.
>

First of all, I'm not really a CLIM wizard (but I'm working on it) so
these solutions may involve some testing on your part.  However, I 
needed similar features and found the manual a little confusing.  I 
got help from the CLIM mailing list, which you should try sometime.
Subscription requests go to ············@bbn.com and submissions go to
····@bbn.com.

I assume you have "city" defined similarly to this:

(define-presentation-type city ()
  :options (color x y orientation))

If not, that's where your first problem is.

>I have a type like "city", and I want to be able to say:
>
>(present current-city 'city
>	:stream stream
>	:color clim:+red+
>	:X 235
>	:Y 115
>	:orientation 'vertical)
>

This should be as follows (see the discussion on presentation type
specifiers in the manual):

(present current-city '((city) :color clim:+red+ 
                               :x 235 
                               :y 115 
                               :orientation vertical)
         :stream stream
         :view +graphical-view+)   ; see below

>The problem is, I can't see form any of the examples, how to add the
>keyword arguments to the defintion:
>
>(clim:define-presentation-method clim:present
>    (city (type city) stream (view clim:textual-view)
                                    ^^^^^^^^^^^^^^^^^
                                    graphical-view ; see below
>	&key color x y orientation)
>...
>

I think if you call present as I have outlined above, you won't get 
the errors for having the keyword arguments.  On the other hand you
don't even need them.  According to the CLIM-2 spec, they become
automatically lexically available in the body of your definition.

>This doesn't work, as I get an error from CLIM:
>
>>>Error: Call to #<Compiled-Function CLIM:PRESENT 73197E> has extra 
>keyword :COLOR
>
>(Any change in params results in the first keyword giving the error,
>so it's not that COLOR was ill-defined).
>
>Is it possible to do what I want?
>
>Also, I'm using CLIM:TEXTUAL-VIEW because it's the only
>presentation-type I know of, but I really should be defining a
>GRAPHICAL-VIEW for this shouldn't I?  How is this done?  The manual is
>rather obtuse on this matter.
>

CLIM-2 has different types of view.  Here's what I do in CLIM-1:

(defclass graphical-view (textual-view)
          ()
  (:documentation "A new view for graphical representations of 
objects."))

(defvar +graphical-view+ (make-instance 'graphical-view)
  "An instance of the view graphical-view.")

This is where the :view came into my present call above.

You should also specify a default method which doesn't specialize
on the view.  I also set the default-view for the panes in which my 
graphical objects are displayed.

>jas
>
>
>--
>--------------------------------------------------------------------------
>Jeffrey A. Sullivan             | Research Scientist et al.
>···@isi.edu (Internet)          | Information Sciences Institute
>72511,402    (Compuserve)       | University of Southern California

Randy

P.S.  If you need more help, feel free to e-mail me.
-- 
Randy A. Coulman                |       ARIES Laboratory
Research Assistant              |       Department of Computational Science
                                |       University of Saskatchewan
·······@cs.Usask.ca             |       Saskatoon, SK   S7N 0W0