in reply to perl/tk HLIST selections options

Selecting everything is simple enough:

# select everything $lb->selectionSet(0, 'end' );

But, you only want to do this if no entry is selected.

@selected = $lb->curselection; unless (@selected) { $lb->selectionSet(0, 'end' ); } foreach (@selected) { # do something with the index in $_ }

Untested!


SciDude
The first dog barks... all other dogs bark at the first dog.

Replies are listed 'Best First'.
Re^2: perl/tk HLIST selections options
by sandeep.ses (Acolyte) on Jul 09, 2004 at 05:06 UTC
    selectionSet(0, 'end' ); dint seem to work it gives me an error entry end not found

      Looking around some more, you may be able to get at the "end" value:

      $listbox->index(index) Returns the integer index value that corresponds to index. If inde +x is end the return value is a count of the number of elements in the + listbox (not the index of the last element).

      Really, really untested code. Good luck!


      SciDude
      The first dog barks... all other dogs bark at the first dog.