A Widget Library
View Ticket
Not logged in
Ticket UUID: 61882d12fbf6ae337d6e6900a26c928362160a90
Title: Bwidet combobox does not always show selected item in list
Type: Bug Version: 1.9.8
Submitter: anonymous Created on: 2016-02-26 15:16:16
Subsystem: bwidget Assigned To: aku
Priority: 5 Medium Severity: Severe
Status: Deleted Last Modified: 2016-02-26 17:07:59
Resolution: Invalid Closed By: oehhar
    Closed on: 2016-02-26 17:07:59
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
    }
}
User Comments: oehhar added on 2016-02-26 17:07:25:
Wrong tracker: widget instead bwidget...

Please resubmit.

Sorry for the inconvenience,
Harald