[mcclim-devel] Presentation types, accept and the like
Anthony Juckel
ajuckel at gmail.com
Sat Jan 15 06:35:19 UTC 2005
This message doesn't pertain to the internal development of McCLIM,
but is rather a general CLIM question. The only CLIM mailing list
that I've found seems to have next to no traffic on it, so this seemed
the best place to send my questions. Perhaps it would be prudent (if
messages like this become a hassle) to create a mcclim-user mailing
list on common-lisp.net?
What is the proper way to go about defining presentation types with
their associated methods, especially accept? For some background, I'm
working on an application for working with a set of objects that I've
defined. In defining these objects, I've done some MOP-ery to allow
me to specify for a given slot on an object, which values are allowed:
(defclass my-class ()
((slot-a :allowed-values ("some" "allowed" "values")))
(:metaclass restricted-slot-value-class))
I've also got the necessary machinery to easily get the allowable
values for a given slot of an object. Now, I'd like to use this
machinery to ease the creation of dialogs pertaining to these objects.
For example, if a user is needing to supply a value for slot-a, I'd
like to display a menu to the user containing the valid values.
The way that I've tried to accomplish this is that I've created a
presentation type for each slot in the object (I know there must be a
more general solution...). Then I've defined an accept method for
these presentation types. Now, in my accept method, I'm trying to use
menu-choose as follows:
(clim:define-presentation-method clim:accept ((type slot-a) stream
view &key &allow-other-keys)
(declare (ignore view))
(clim:menu-choose (allowed-values 'slot-a)))
I then create a dialog using accepting-values, which in turn calls
this accept method. This isn't giving me the desired behavior though.
When I click on the input field for slot-a, I do get the proper menu
displayed, but when I first choose an option, it doesn't appear to
have any effect, but does redisplay the menu again. After choosing a
menu option a second time, the choice does indeed seem to stick.
Am I just missing a step, or have I wondered down a wrong path
entirely? Does anyone have any advice for how better to handle such a
situation?
Anthony W. Juckel
More information about the mcclim-devel
mailing list