anirban2k2001
Programmer
Hi all!
My combo box fetches values from a backend database.But when I select any value, only the last value in the list is displayed.
Kindly help.
I am giving below the code for reference:
############################################################
# To use alchemy API do the following
package require picoapi
update idletasks
# The following gets executed, when the application is closed
wm protocol . WM_DELETE_WINDOW {
# You can do some wrap-up work here, before the application quits
exit
}
source combobox.tcl
package require combobox 2.3
catch {namespace import combobox::*}
# Following are the different kind of PicoPeta fonts
# set fnt7 "-picopeta-simputer-medium-r-normal--7-120-101-108-p-120-fontspecific-0"
# set fnt9 "-picopeta-simputer-medium-r-normal--9-120-101-108-p-120-fontspecific-0"
# set fnt11 "-picopeta-simputer-medium-r-normal--11-120-101-108-p-120-fontspecific-0"
# set fnt11b "-picopeta-simputer-bold-r-normal--11-120-101-108-p-120-fontspecific-0"
# set fnt14 "-picopeta-simputer-medium-r-normal--14-120-101-108-p-120-fontspecific-0"
# Set the title and the status here
# By default title and status fonts are fnt9
# Status message is always right justified by default
wm title . "Meter Details"
alchemy status_msg "Meter Details"
# Annotate icon is ON by default. Turn it OFF, because we don't need it here.
# Using the annotation is shown in example 006
alchemy annotate off
# Hard coded value for temporary purposes
set argc 2
if {$argc!=2} {
puts stderr "Database error"
exit 1
}
set fp [frame .fontpicker]
set msg [label .msg -borderwidth 2 -relief groove -width 30 -height 4]
pack $fp -side top -fill x
pack $msg -side top -fill both -expand y -pady 2
load /usr/lib/tclsqlite-2.8.15.so Sqlite
sqlite db1 /root/cesc_simputer.db
label $fp.famLabel -text "Select Consumer No:"
combobox $fp.famCombo \
-borderwidth 1 \
-textvariable abc \
-editable false \
-highlightthickness 1 \
-command
My combo box fetches values from a backend database.But when I select any value, only the last value in the list is displayed.
Kindly help.
I am giving below the code for reference:
############################################################
# To use alchemy API do the following
package require picoapi
update idletasks
# The following gets executed, when the application is closed
wm protocol . WM_DELETE_WINDOW {
# You can do some wrap-up work here, before the application quits
exit
}
source combobox.tcl
package require combobox 2.3
catch {namespace import combobox::*}
# Following are the different kind of PicoPeta fonts
# set fnt7 "-picopeta-simputer-medium-r-normal--7-120-101-108-p-120-fontspecific-0"
# set fnt9 "-picopeta-simputer-medium-r-normal--9-120-101-108-p-120-fontspecific-0"
# set fnt11 "-picopeta-simputer-medium-r-normal--11-120-101-108-p-120-fontspecific-0"
# set fnt11b "-picopeta-simputer-bold-r-normal--11-120-101-108-p-120-fontspecific-0"
# set fnt14 "-picopeta-simputer-medium-r-normal--14-120-101-108-p-120-fontspecific-0"
# Set the title and the status here
# By default title and status fonts are fnt9
# Status message is always right justified by default
wm title . "Meter Details"
alchemy status_msg "Meter Details"
# Annotate icon is ON by default. Turn it OFF, because we don't need it here.
# Using the annotation is shown in example 006
alchemy annotate off
# Hard coded value for temporary purposes
set argc 2
if {$argc!=2} {
puts stderr "Database error"
exit 1
}
set fp [frame .fontpicker]
set msg [label .msg -borderwidth 2 -relief groove -width 30 -height 4]
pack $fp -side top -fill x
pack $msg -side top -fill both -expand y -pady 2
load /usr/lib/tclsqlite-2.8.15.so Sqlite
sqlite db1 /root/cesc_simputer.db
label $fp.famLabel -text "Select Consumer No:"
combobox $fp.famCombo \
-borderwidth 1 \
-textvariable abc \
-editable false \
-highlightthickness 1 \
-command
grid $fp.famLabel -row 0 -column 0 -sticky e
grid $fp.famCombo -row 0 -column 1 -sticky ew
grid columnconfigure $fp 1 -weight 1
db1 eval {select con_no from mri} values {
parray values
$fp.famCombo list insert end $values(con_no)
puts ""
}
# Buttons to change the keyboard layout
# button .b1 -text "Submit" -command {alchemy source test.tcl}
button .b1 -text "Submit" -command {puts $values(con_no)}
place .b1 -x 40 -y 40 -width 90 -height 25
button .b2 -text "Exit" -command exit
place .b2 -x 140 -y 40 -width 90 -height 25
############################################################