I keep a list of the items I inserted into the list box on the Lisp
side and use the result of listbox-get-selection to look up the items
in the list. As the objects in that list usually carry more
information than the pure strings displayed in the list box, that is
usually more useful anyway.
On Thu, Nov 1, 2012 at 4:46 PM, Nikita B. Zuev wrote:
> I'm having a little trouble with usage of a listbox in LTK library,
> and would appreciate some assistance.
> Documentation states that there is a LISTBOX class
> but nothing about how to manipulate its contents.
> Google have helped me to find LISTBOX-APPEND to add items and
> LISTBOX-GET-SELECTION to
> retrieve selection. Thing here is LISTBOX-GET-SELECTION returns list
> of indices, not actual items,
> and nothing in google says about where to apply index to get actual
> selected item.
> That is easy to workaround by using a separate variable to store list
> of items and pushing to it
> after adding item to LISTBOX instance, then getting selection from
> LISTBOX and getting selected
> item from this variable by index, but I have a feeling that I'm doing
> it wrong, and overcomplicating
> Also docs say
> :COMMAND initarg can be used to handle LISTBOX's selection change event,
> (MAKE-INSTANCE 'LISTBOX :command (lambda () ... )) fails saying it has
> no such initarg,
> well BIND works, so its ok probably.
> Main question is, can someone please provide me with a little example
> of LISTBOX's proper usage?
> LTK library is from the quicklisp repository.
> Nikita B. Zuev
> ltk-user site list