From: Lloyd Moore
Subject: Lisp and listboxes
Date: 
Message-ID: <4385ca5a.0302011059.66cfc1b@posting.google.com>
I am an embryo Lisp programmer and learning from first principles, so
please would somebody help me answer the following?

I am attempting to pass the selected values from one listbox into the
range of another; both widgets sit on the same form. The interface has
been created in Allegro CL, 2 multi-item listboxes sit on a form. Each
listbox has RANGE (the set of displayed items) and VALUE (the set of
selected items. The range in the first list is pre-set awaiting
selection.

The way I have approached this is to create a global variable
*repeats* in the application. I have then defined a click event for a
button on the child form where the listboxes sit: -

(defun unf-dialog-first-list-on-click (dialog widget)
(declare (ignore-if-unused dialog widget))
   (let ((list-box (find-component-widget 'first-list)))
    (setq *repeats* (value list-box))
     ;;ensure pno is not deselected
    (pushnew "pno" *repeats* :test #'string-equal))
    (close dialog))

The trouble is, the program keeps grumbling [No methods applicable for
generic function #<standard-generic-function VALUE with args
(first-list)
of class (SYMBOL)]

I have tried defining methods within the expression without success.

Any ideas? Also, how would I then populate the RANGE of second list
based on the contents of *repeats*?

From: Kenny Tilton
Subject: Re: Lisp and listboxes
Date: 
Message-ID: <3E3C881F.9050207@nyc.rr.com>
Lloyd Moore wrote:
> I am an embryo Lisp programmer and learning from first principles, so
> please would somebody help me answer the following?
> 
> I am attempting to pass the selected values from one listbox into the
> range of another; both widgets sit on the same form. The interface has
> been created in Allegro CL, 2 multi-item listboxes sit on a form. Each
> listbox has RANGE (the set of displayed items) and VALUE (the set of
> selected items. The range in the first list is pre-set awaiting
> selection.
> 
> The way I have approached this is to create a global variable
> *repeats* in the application. I have then defined a click event for a
> button on the child form where the listboxes sit: -
> 
> (defun unf-dialog-first-list-on-click (dialog widget)
> (declare (ignore-if-unused dialog widget))
>    (let ((list-box (find-component-widget 'first-list)))
>     (setq *repeats* (value list-box))
>      ;;ensure pno is not deselected
>     (pushnew "pno" *repeats* :test #'string-equal))
>     (close dialog))
> 
> The trouble is, the program keeps grumbling [No methods applicable for
> generic function #<standard-generic-function VALUE with args
> (first-list)
> of class (SYMBOL)]
> 
> I have tried defining methods within the expression without success.

Try thinking instead. :) consider: value is called on the local variable 
list-box which you think is bound to the first-list widget. When Lisp 
whines that it does not know how to (value <symbol>), your problem is 
not a missing value method, your problem is that list-box contains a 
symbol. This might be related to the fact that ACL does not have a 
find-component-widget function, it has find-component. Did you write a 
find-component-widget function? Is it returning the symbolic name sought 
instead of the widget sought?

But forget all that. The widget argument to 
unf-dialog-first-list-on-click is the clicked thang, aka first-list 
assuming that is the only widget for which you have used this callback. 
ie, you do not have to go find the component, it is being passed to your 
callback (and that is helpful precisely to save you the trouble of 
hunting down the thang clicked).

> Any ideas? Also, how would I then populate the RANGE of second list
> based on the contents of *repeats*?

You need Cello, not ACL Common Graphics. But Cello is not ready yet, so 
you cannot simply set the global, you have to:

(defun unf-dialog-first-list-on-click (dialog list-box)
   (let ((list-box-second (find-component 'second-list) dialog))
      (list-box-range-rethink list-box-second
         (adjoin "pno" (value list-box)))))

..and then you can skip the global thang. But you do have to write the 
"rethink" function, but I wager that code is already written somewhere 
in the middle of another function.

-- 

  kenny tilton
  clinisys, inc
  http://www.tilton-technology.com/
  ---------------------------------------------------------------
"Cells let us walk, talk, think, make love and realize
  the bath water is cold." -- Lorraine Lee Cudmore
From: Lloyd Moore
Subject: Re: Lisp and listboxes
Date: 
Message-ID: <4385ca5a.0302020134.320a982a@posting.google.com>
Kenny Tilton <·······@nyc.rr.com> wrote in message news:<················@nyc.rr.com>...
> Lloyd Moore wrote:
> > I am an embryo Lisp programmer and learning from first principles, so
> > please would somebody help me answer the following?
> > 
> > I am attempting to pass the selected values from one listbox into the
> > range of another; both widgets sit on the same form. The interface has
> > been created in Allegro CL, 2 multi-item listboxes sit on a form. Each
> > listbox has RANGE (the set of displayed items) and VALUE (the set of
> > selected items. The range in the first list is pre-set awaiting
> > selection.
> > 
> > The way I have approached this is to create a global variable
> > *repeats* in the application. I have then defined a click event for a
> > button on the child form where the listboxes sit: -
> > 
> > (defun unf-dialog-first-list-on-click (dialog widget)
> > (declare (ignore-if-unused dialog widget))
> >    (let ((list-box (find-component-widget 'first-list)))
> >     (setq *repeats* (value list-box))
> >      ;;ensure pno is not deselected
> >     (pushnew "pno" *repeats* :test #'string-equal))
> >     (close dialog))
> > 
> > The trouble is, the program keeps grumbling [No methods applicable for
> > generic function #<standard-generic-function VALUE with args
> > (first-list)
> > of class (SYMBOL)]
> > 
> > I have tried defining methods within the expression without success.
> 
> Try thinking instead. :) consider: value is called on the local variable 
> list-box which you think is bound to the first-list widget. When Lisp 
> whines that it does not know how to (value <symbol>), your problem is 
> not a missing value method, your problem is that list-box contains a 
> symbol. This might be related to the fact that ACL does not have a 
> find-component-widget function, it has find-component. Did you write a 
> find-component-widget function? Is it returning the symbolic name sought 
> instead of the widget sought?
> 
> But forget all that. The widget argument to 
> unf-dialog-first-list-on-click is the clicked thang, aka first-list 
> assuming that is the only widget for which you have used this callback. 
> ie, you do not have to go find the component, it is being passed to your 
> callback (and that is helpful precisely to save you the trouble of 
> hunting down the thang clicked).
> 
> > Any ideas? Also, how would I then populate the RANGE of second list
> > based on the contents of *repeats*?
> 
> You need Cello, not ACL Common Graphics. But Cello is not ready yet, so 
> you cannot simply set the global, you have to:
> 
> (defun unf-dialog-first-list-on-click (dialog list-box)
>    (let ((list-box-second (find-component 'second-list) dialog))
>       (list-box-range-rethink list-box-second
>          (adjoin "pno" (value list-box)))))
> 
> ..and then you can skip the global thang. But you do have to write the 
> "rethink" function, but I wager that code is already written somewhere 
> in the middle of another function.

Now I'm really confused. I don't see how your code identifies the
first list box that passes the selections into the second. Please bear
in mind that I am a beginner so keep it simple for the cerebrally
challenged!
Where might I find sample code for your "rethink"?

Thanks,
From: Lloyd Moore
Subject: Re: Lisp and listboxes
Date: 
Message-ID: <4385ca5a.0302020259.766b33ef@posting.google.com>
Kenny Tilton <·······@nyc.rr.com> wrote in message news:<················@nyc.rr.com>...
> Lloyd Moore wrote:
> > I am an embryo Lisp programmer and learning from first principles, so
> > please would somebody help me answer the following?
> > 
> > I am attempting to pass the selected values from one listbox into the
> > range of another; both widgets sit on the same form. The interface has
> > been created in Allegro CL, 2 multi-item listboxes sit on a form. Each
> > listbox has RANGE (the set of displayed items) and VALUE (the set of
> > selected items. The range in the first list is pre-set awaiting
> > selection.
> > 
> > The way I have approached this is to create a global variable
> > *repeats* in the application. I have then defined a click event for a
> > button on the child form where the listboxes sit: -
> > 
> > (defun unf-dialog-first-list-on-click (dialog widget)
> > (declare (ignore-if-unused dialog widget))
> >    (let ((list-box (find-component-widget 'first-list)))
> >     (setq *repeats* (value list-box))
> >      ;;ensure pno is not deselected
> >     (pushnew "pno" *repeats* :test #'string-equal))
> >     (close dialog))
> > 
> > The trouble is, the program keeps grumbling [No methods applicable for
> > generic function #<standard-generic-function VALUE with args
> > (first-list)
> > of class (SYMBOL)]
> > 
> > I have tried defining methods within the expression without success.
> 
> Try thinking instead. :) consider: value is called on the local variable 
> list-box which you think is bound to the first-list widget. When Lisp 
> whines that it does not know how to (value <symbol>), your problem is 
> not a missing value method, your problem is that list-box contains a 
> symbol. This might be related to the fact that ACL does not have a 
> find-component-widget function, it has find-component. Did you write a 
> find-component-widget function? Is it returning the symbolic name sought 
> instead of the widget sought?
> 
> But forget all that. The widget argument to 
> unf-dialog-first-list-on-click is the clicked thang, aka first-list 
> assuming that is the only widget for which you have used this callback. 
> ie, you do not have to go find the component, it is being passed to your 
> callback (and that is helpful precisely to save you the trouble of 
> hunting down the thang clicked).
> 
Kenny,
sorry, I missed the first part of your reply. The
find-component-widget was a typo - it should have read (let ((list-box
(find-component widget 'first-list)))
In any case you are saying that I don't need to find the component, so
can I just pass the selected values (I want to enable multiple
selections) to a local variable? A bit of sample code here would help
me no end.

Many thanks.
From: Kenny Tilton
Subject: Re: Lisp and listboxes
Date: 
Message-ID: <3E3DBD81.6030902@nyc.rr.com>
Lloyd Moore wrote:
> Kenny,
> sorry, I missed the first part of your reply. The
> find-component-widget was a typo - it should have read (let ((list-box
> (find-component widget 'first-list)))

never type in code then ask for help with it. every time i do that i get 
burnt. cut and paste actual code and error messages from your source and 
listener into the email.

that is a good general rue, and it applies here very specifically 
because one can deduce from your problem report that find-component 
returns a symbol. it does not. maybe in all the thrashing you are 
combining two problem reports in one.

> In any case you are saying that I don't need to find the component, so
> can I just pass the selected values (I want to enable multiple
> selections) to a local variable? A bit of sample code here would help
> me no end.

I already supplied it, you just can't believe it is that easy. I almost 
jokingly wrote "see that (ignore dialog widget) declaration? that's your 
problem". why do you think those callback arguments are there?

as for me supplying the code to rethink, hello? look at your code for 
the second list-box that works off the initial value of the global. that 
is the heart of the code for your rethink function.

maybe you should post that code, along with the actual code
complaining there is no 'value method for symbols.

the good news is that this is really easy and you are pretty close to 
having it worked out. no mysteries are in your way, yer just going thru 
a learning curve. btw, how are your OO skills?


-- 

  kenny tilton
  clinisys, inc
  http://www.tilton-technology.com/
  ---------------------------------------------------------------
"Cells let us walk, talk, think, make love and realize
  the bath water is cold." -- Lorraine Lee Cudmore