Hello,
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 http://www.peter-herth.de/ltk/ltkdoc/node25.html 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 things.
Also docs say http://www.peter-herth.de/ltk/ltkdoc/node15.html :COMMAND initarg can be used to handle LISTBOX's selection change event, but (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.
Thanks.
Hi,
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.
Peter
On Thu, Nov 1, 2012 at 4:46 PM, Nikita B. Zuev nikitazu@gmail.com wrote:
Hello,
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 http://www.peter-herth.de/ltk/ltkdoc/node25.html 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 things.
Also docs say http://www.peter-herth.de/ltk/ltkdoc/node15.html :COMMAND initarg can be used to handle LISTBOX's selection change event, but (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.
Thanks.
-- Regards, Nikita B. Zuev
ltk-user site list ltk-user@common-lisp.net http://common-lisp.net/mailman/listinfo/ltk-user
Hello,
thanks, I'm doing the same, didn't know that listbox stores them as strings though. Never used Tk actually ))
2012/11/2 Peter Herth herth@peter-herth.de:
Hi,
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.
Peter
On Thu, Nov 1, 2012 at 4:46 PM, Nikita B. Zuev nikitazu@gmail.com wrote:
Hello,
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 http://www.peter-herth.de/ltk/ltkdoc/node25.html 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 things.
Also docs say http://www.peter-herth.de/ltk/ltkdoc/node15.html :COMMAND initarg can be used to handle LISTBOX's selection change event, but (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.
Thanks.
-- Regards, Nikita B. Zuev
ltk-user site list ltk-user@common-lisp.net http://common-lisp.net/mailman/listinfo/ltk-user
ltk-user site list ltk-user@common-lisp.net http://common-lisp.net/mailman/listinfo/ltk-user