
CLIM: keyword paramters for presentation types?
Quote:
>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.
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.
Quote:
>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
Quote:
>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
Quote:
> &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.
Quote:
>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.
Quote:
>jas
>--
>--------------------------------------------------------------------------
>Jeffrey A. Sullivan | Research Scientist et al.
>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