CLIM mail archive


RE: presentation type question

  I have a situation in which I present a lot of objects to a CLIM pane as one
  presentation-type.  It's likely that there will be more that one of these frames
  enabled at one time, all of which use the same presentation-type.  Inside a
  command, I use ACCEPT to have the user select one of the items.  How can I cause
  only the objects in a specified frame to be mouse-sensitive?  (i.e. I don't want
  objects of the same presentation-type in any other frame to highlight when the
  mouse pointer is over it.)

In general, mouse sensitivity is controlled by "input context."  Input context
is the presentation type you are currently accepting.  As you have found out,
when you call ACCEPT, all the presentations in all the windows will highlight
(because they are all "acceptable").  What you want to do is to make some
of them "unacceptable."  

I can think of two ways to do this.  Adding data arguments to a presentation-type
can be done to constrain the type of the object.  For example, an input context
such as (NUMBER 5 10) should make one set of numbers mouse-sensitive, while
the context (NUMBER 10 20) should make a different set sensitive.
This approach seems a bit kludgey, however, for the case you describe.

Second, you can set up a second presentation-type that acts as a "filter".
Suppose you only wanted STRINGs from a certain window.  Then you may define
a presentation translator to go from STRING to WINDOW-STRING as follows:

(defvar *currently-interesting-window* (some-window))

(define-presentation-translator string-to-window-string
   (string window-string
	:gesture :left
	:tester ((window) (eq *currently-interesting-window* window)))

(accept 'frame-string)

If the tester returns T, then the presentation is acceptable, else it is
not acceptable.

jeff morrill

PS.  You may wish to reconsider your approach to the problem.  It is
rare to want to restrict the window that presentations come from.  The
only example I can think of is the ACCEPTING-VALUES program.  If
there is something about their window location from which you are
inferring DATA TYPE information, then perhaps that type information
can be used as a presentation-type argument, as in the NUMBER example


Main Index | Thread Index