CLIM: keyword paramters for presentation types? 
Author Message
 CLIM: keyword paramters for presentation types?

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:

Quote:
>>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.

72511,402    (Compuserve)       | University of Southern California



Mon, 03 Jul 1995 05:00:18 GMT  
 CLIM: keyword paramters for presentation types?

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.

Quote:

>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.




Tue, 04 Jul 1995 01:00:39 GMT  
 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



Tue, 04 Jul 1995 06:55:59 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. CLIM presentation-type-of specializing

2. CLIM Presentation Type

3. Info wanted on CLIM presentation-types

4. presentation types in genera

5. derived types with parameter keyword

6. extracting keywords from %(keyword)s-based templates

7. passing keyword arguments that are themselfs python keywords

8. reading paramters

9. PLI1.0: How to access complex paramters

10. non static signals as actual paramters for procedures

11. passing paramters via stack in asm

12. Passing paramters through an exec call

 

 
Powered by phpBB® Forum Software