Dave Phillips wrote:

>   1. I have a series of entry boxes, some of which are for wavefile
> filenames, and a button to activate vplay. I'd like vplay to play the
> soundfile in the highlighted entry box, i.e., the box with the active
> cursor, but I don't know how to go about doing that. Is there some sort
> of getCursorSelection function in tcl ?
> 
>   2. I'd like to clear all entries with a button-press. Again, is there
> already a usable function in tcl, or can someone provide an example ?

You need to look at the man pages for the Tk widgets that you're using.

If you're using the entry widgets, then here are the answers to the
questions above:

     pathName delete first ?last?
          Delete one or more elements of the entry.  First is the
          index of the first character to delete, and last is the
          index of the character  just  after  the  last  one  to
          delete.    If  last  isn't  specified  it  defaults  to
          first+1, i.e. a single character is deleted.  This com-
          mand returns an empty string.

     pathName get
          Returns the entry's string.

If your entry box is $e1, then get the text with [$e1 get] and delete it
with [$e1 delete 0 end]. It might be tricky to know which box is
selected, however.

When you say "a series of entry boxes", it sounds like you might want to
use a listbox instead. Listboxes know what is currently selected. The
get the highlighted item(s) from a listbox called $l, you just do [$l
get [$l curselection]].

-- 
...RickM...

Reply via email to