multiple listboxes with multiple select 
Author Message
 multiple listboxes with multiple select

I have linked several listboxes together using bindings. All listboxes
but the first are created using -exportselection false. Now, I want to
select multiple entries from every listbox. For example, when I click
the first entry in a listbox, all the first entries in all listboxes are
selected. When I click the second entry in a listbox, I want all second
entries in all listboxes to be selected as well.

Here is the code that handles a click or drag in the listboxes:
proc BindSelectMultiple {w y args} {
  set index [$w nearest $y]

  # First create a list of the other listboxes
  set rm [lsearch $args $w]
  set args [lreplace $args $rm $rm]

  # Synchronize selection of other listboxes
  set relpos [$w yview]
  foreach otherlb $args {
    $otherlb yview moveto [lindex $relpos 0]
    if {[$otherlb selection includes $index]} {
      $otherlb select clear $index
    } else {
      $otherlb select set $index
    }
  }

  # Change selection of this listbox
  if {[$w selection includes $index]} {
    $w select clear $index
  } else {
    $w select set $index
  }

Quote:
}

When I click an entry in a listbox, the entries in the other listboxes
are selected, the entry in the listbox I clicked remains deselected. I
have tried adding a 'sleep' at the end of this routine, using vwait. I
noticed that the entry in the listbox I clicked was selected until the
BindSelectMultiple routine was finished. Then the enty was deselected.

How can I get multiple selections on multiple listboxes working
properly?

Thanks for any help,
R. Moolenaar

Sent via Deja.com http://www.*-*-*.com/
Share what you know. Learn what you don't.



Sun, 03 Mar 2002 03:00:00 GMT  
 multiple listboxes with multiple select

Quote:

> I have linked several listboxes together using bindings. All listboxes
> but the first are created using -exportselection false. Now, I want to
> select multiple entries from every listbox. For example, when I click
> the first entry in a listbox, all the first entries in all listboxes are
> selected. When I click the second entry in a listbox, I want all second
> entries in all listboxes to be selected as well.

Please see the FAQ answer for this topic:
        http://www.purl.org/net/hobbs/tcl/faqs/tk/

--
   Jeffrey Hobbs                          The Tcl Guy
   jeffrey.hobbs at scriptics.com         Scriptics Corp.



Sun, 03 Mar 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. multiple listboxes with selectmode multiple

2. Linked listboxes: multiple select?

3. Multiple select listbox

4. selecting different items from multiple listboxes

5. selecting multiple items in a listbox?

6. Select across multiple listboxes

7. selecting items in multiple listboxes

8. Q:selecting multiple lines in a listbox

9. Select multiple disjoing entries in a listbox

10. Question: selecting in multiple listboxes

11. noncontiguous multiple select listbox class binding?

12. multiple listboxes with single select... and defeerred action

 

 
Powered by phpBB® Forum Software