y9john
Programmer
- Jan 27, 2011
- 2
Hi everyone I am working on a gui for the program I am making. I have a window that has notebook with a listbox imbedded in each tab. I am currently trying to get the selection in the tabbed listbox to show up in a listbox I have outside the notebook. I can get it working by binding the double click of the mouse to do it but it keeps erroring out when I try using the button press. I was wondering if anyone has any suggestions for getting it working. Below is the line for the button and the double click.
Double
bind $bw.commands.niagara.box <Double-1> [list ::CILSUITE::ListTransferSel %W $bw.new_script]
Button
grid [ttk::button $bw.add_button -text "Add ->"] -column 9 -row 3
$bw.add_button configure -command [::CILSUITE::ListTransferSel %W $bw.new_script]
List Transfer Sel Proc
proc ListTransferSel {src dst} {
foreach i [$src curselection] {
$dst insert end [$src get $i]
}
}
Note book and listbox code
grid [ttk::notebook $bw.commands -style System.TNotebook] -columnspan 5 -rowspan 10 -sticky nwes
ttk::frame $bw.commands.niagara
$bw.commands.niagara configure -borderwidth 2
ttk::frame $bw.commands.f2
$bw.commands.f2 configure -borderwidth 2
$bw.commands add $bw.commands.niagara -text "niagara"
$bw.commands add $bw.commands.f2 -text "HP"
grid [tk::listbox $bw.commands.niagara.box -yscrollcommand "$bw.commands.niagara.box_bar set" -selectmode extended -height 5] -column 0 -row 0 -rowspan 5 -columnspan 5 -sticky nwes
grid [ttk::scrollbar $bw.commands.niagara.box_bar -command "$bw.commands.niagara.box yview" -orient vertical] -column 6 -row 0 -rowspan 5 -sticky ns
grid [tk::listbox $bw.commands.f2.box -yscrollcommand "$bw.commands.f2.box_bar set" -selectmode extended -height 5] -column 0 -row 0 -rowspan 5 -columnspan 5 -sticky nwes
grid [ttk::scrollbar $bw.commands.f2.box_bar -command "$bw.commands.f2.box yview" -orient vertical] -column 6 -row 0 -rowspan 5 -sticky ns
grid [tk::listbox $bw.new_script -yscrollcommand "$bw.new_script_bar set" -selectmode extended -height 5] -column 11 -row 0 -columnspan 5 -rowspan 10 -sticky nwes
grid [ttk::scrollbar $bw.new_script_bar -command "$bw.new_script yview" -orient vertical] -column 17 -row 0 -rowspan 10 -sticky ns
Any help would be appreciated. Also if I didn't post it right or something to that effect, just let me know and I will fix it.
Thank you.
Double
bind $bw.commands.niagara.box <Double-1> [list ::CILSUITE::ListTransferSel %W $bw.new_script]
Button
grid [ttk::button $bw.add_button -text "Add ->"] -column 9 -row 3
$bw.add_button configure -command [::CILSUITE::ListTransferSel %W $bw.new_script]
List Transfer Sel Proc
proc ListTransferSel {src dst} {
foreach i [$src curselection] {
$dst insert end [$src get $i]
}
}
Note book and listbox code
grid [ttk::notebook $bw.commands -style System.TNotebook] -columnspan 5 -rowspan 10 -sticky nwes
ttk::frame $bw.commands.niagara
$bw.commands.niagara configure -borderwidth 2
ttk::frame $bw.commands.f2
$bw.commands.f2 configure -borderwidth 2
$bw.commands add $bw.commands.niagara -text "niagara"
$bw.commands add $bw.commands.f2 -text "HP"
grid [tk::listbox $bw.commands.niagara.box -yscrollcommand "$bw.commands.niagara.box_bar set" -selectmode extended -height 5] -column 0 -row 0 -rowspan 5 -columnspan 5 -sticky nwes
grid [ttk::scrollbar $bw.commands.niagara.box_bar -command "$bw.commands.niagara.box yview" -orient vertical] -column 6 -row 0 -rowspan 5 -sticky ns
grid [tk::listbox $bw.commands.f2.box -yscrollcommand "$bw.commands.f2.box_bar set" -selectmode extended -height 5] -column 0 -row 0 -rowspan 5 -columnspan 5 -sticky nwes
grid [ttk::scrollbar $bw.commands.f2.box_bar -command "$bw.commands.f2.box yview" -orient vertical] -column 6 -row 0 -rowspan 5 -sticky ns
grid [tk::listbox $bw.new_script -yscrollcommand "$bw.new_script_bar set" -selectmode extended -height 5] -column 11 -row 0 -columnspan 5 -rowspan 10 -sticky nwes
grid [ttk::scrollbar $bw.new_script_bar -command "$bw.new_script yview" -orient vertical] -column 17 -row 0 -rowspan 10 -sticky ns
Any help would be appreciated. Also if I didn't post it right or something to that effect, just let me know and I will fix it.
Thank you.