anirban2k2001
Programmer
Hi all,
I have a listbox in a frame. The listbox is populated with values from the backend. Since there will be many items in the list, I want to add a vertical scrollbar to the list box. I am giving below the code that I have used for the purpose, but the scrollbar does not show up as a result of which I am not able to scroll.
###########################CODE##################################
#Creating a Frame
frame .f -width 230 -height 270
pack .f
pack propagate .f 0
#creating a listbox with a scroll bar
label .f.name -text "Select consumer no." -font $fnt11b
place .f.name -x 10 -y 5
listbox .f.l -yscrollcommand {.f.s set} -font $fnt9
place .f.l -x 10 -y 40 -width 220 -height 130
#Defining a scroll bar for the listbox
scrollbar .f.s -orient vertical -command {.f.l yview}
place .f.s -x 230 -y 40 -width 10 -height 130
# Fetching and populating values from backend
set connection_no { }
set stmt "select con_no from mri;"
db1 eval $stmt {} {
lappend connection_no $con_no
.f.l insert end $con_no
}
Kindly help.
Regards,
Anirban Sarkar
I have a listbox in a frame. The listbox is populated with values from the backend. Since there will be many items in the list, I want to add a vertical scrollbar to the list box. I am giving below the code that I have used for the purpose, but the scrollbar does not show up as a result of which I am not able to scroll.
###########################CODE##################################
#Creating a Frame
frame .f -width 230 -height 270
pack .f
pack propagate .f 0
#creating a listbox with a scroll bar
label .f.name -text "Select consumer no." -font $fnt11b
place .f.name -x 10 -y 5
listbox .f.l -yscrollcommand {.f.s set} -font $fnt9
place .f.l -x 10 -y 40 -width 220 -height 130
#Defining a scroll bar for the listbox
scrollbar .f.s -orient vertical -command {.f.l yview}
place .f.s -x 230 -y 40 -width 10 -height 130
# Fetching and populating values from backend
set connection_no { }
set stmt "select con_no from mri;"
db1 eval $stmt {} {
lappend connection_no $con_no
.f.l insert end $con_no
}
Kindly help.
Regards,
Anirban Sarkar