Description: |
Corrected version of mapliste which calls see on the listbos with some delay.
The listbox does not properly scroll to the selected entry on FIRST open! The patch fixes the problem.
proc ComboBox::_mapliste { path } {
set listb $path.shell.listb
if {[winfo exists $path.shell] &&
[string equal [wm state $path.shell] "normal"]} {
_unmapliste $path
return
}
if { [Widget::cget $path -state] == "disabled" } {
return
}
if {[llength [set cmd [Widget::getMegawidgetOption $path -postcommand]]]} {
uplevel \#0 $cmd
}
if { ![llength [Widget::getMegawidgetOption $path -values]] } {
return
}
_recreate_popup $path
ArrowButton::configure $path.a -relief sunken
update
set bw [Widget::cget $path -bwlistbox]
$listb selection clear 0 end
set values [Widget::getMegawidgetOption $path -values]
set curval [Entry::cget $path.e -text]
if { [set idx [lsearch -exact $values $curval]] == -1 &&
[set idx [lsearch -exact $values "$curval*"]] == -1 } {
set idx 0
}
if {$bw} {
set idx [$listb items $idx]
} else {
$listb activate $idx
}
$listb selection set $idx
$listb see $idx
# After idle does not work, make sure selected item is visible!
after 100 [list $listb see $idx];
set width [Widget::cget $path -listboxwidth]
if {!$width} { set width [winfo width $path] }
BWidget::place $path.shell $width 0 below $path
wm deiconify $path.shell
raise $path.shell
BWidget::focus set $listb
if {! $Widget::_aqua } {
BWidget::grab global $path
}
}
|