Bwidget Source Code
Check-in [9c20e19e15]
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix combobox failure in themed mode [cc3b12e22f]
Timelines: family | ancestors | descendants | both | bwidget
Files: files | file ages | folders
SHA1: 9c20e19e15fdee6aad9602dc89377002312afac8
User & Date: oehhar 2013-10-14 15:28:00
References
2013-10-14
15:33 Closed ticket [cc3b12e22f]: Error setting ListBox background in themed mode plus 7 other changes artifact: 0525c6c53f user: oehhar
Context
2013-10-14
15:53
ListBox update, border with images and image selection fixed [ff1787af9c] check-in: 67d6d7d3b3 user: oehhar tags: bwidget
15:28
Fix combobox failure in themed mode [cc3b12e22f] check-in: 9c20e19e15 user: oehhar tags: bwidget
2013-10-07
14:46
Sometimes the tooltip does not occur under gnome/metacity on ubuntu. Ticket [a588d2f800] check-in: 459482f1b1 user: oehhar tags: bwidget
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.







1
2
3
4
5
6
7





2013-10-07 Harald Oehlmann <[email protected]>
	dynhelp.tcl: Sometimes the tooltip does not occur under
	gnome/metacity on ubuntu. By Wolfgang S. Kechel.
	Ticket [a588d2f800]

2013-09-15 Harald Oehlmann <[email protected]>

>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
2013-10-07 Harald Oehlmann <[email protected]>
	combobox.tcl: Fails in themed mode with "unknown
	option -bg". Patch solves this but listbox items
	are white on white when "-foreground" is specified.
	By Wolfgang S. Kechel. Ticket [cc3b12e22f]

2013-10-07 Harald Oehlmann <[email protected]>
	dynhelp.tcl: Sometimes the tooltip does not occur under
	gnome/metacity on ubuntu. By Wolfgang S. Kechel.
	Ticket [a588d2f800]

2013-09-15 Harald Oehlmann <[email protected]>

Changes to combobox.tcl.

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
...
295
296
297
298
299
300
301

302



303
304
305
306

307
308
309
310
311
312
313
...
454
455
456
457
458
459
460









461
462
463
464
465
466
467
...
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
...
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
...
605
606
607
608
609
610
611
612
613
614
615

616
617
618
619
620
621
622
#  Index of commands:
#     - ComboBox::create
#     - ComboBox::configure
#     - ComboBox::cget
#     - ComboBox::setvalue
#     - ComboBox::getvalue
#     - ComboBox::clearvalue
#     - ComboBox::getentrypath
#     - ComboBox::_create_popup
#     - ComboBox::_mapliste
#     - ComboBox::_unmapliste
#     - ComboBox::_select
#     - ComboBox::_modify_value
# ----------------------------------------------------------------------------

................................................................................
        Entry::configure $entry -takefocus 1
    }

    # if the dropdown listbox is shown, simply force the actual entry
    #  colors into it. If it is not shown, the next time the dropdown
    #  is shown it'll get the actual colors anyway
    if {[winfo exists $path.shell.listb]} {

	$path.shell.listb configure \



		-bg [Widget::cget $path -entrybg] \
		-fg [Widget::cget $path -foreground] \
		-selectbackground [Widget::cget $path -selectbackground] \
		-selectforeground [Widget::cget $path -selectforeground]

    }

    return $res
}


# ----------------------------------------------------------------------------
................................................................................
# ----------------------------------------------------------------------------
#  Command ComboBox::getentry
# ----------------------------------------------------------------------------
proc ComboBox::getentry { path } {
    return $path.e
}










# ----------------------------------------------------------------------------
#  Command ComboBox::_create_popup
# ----------------------------------------------------------------------------
proc ComboBox::_create_popup { path } {
    set shell $path.shell

    if {[winfo exists $shell]} { return }
................................................................................
    if {$bw} {
        if {[Widget::theme]} {
            set listb  [ListBox $shell.listb \
                    -relief flat -borderwidth 0 -highlightthickness 0 \
                    -selectmode single -selectfill 1 -autofocus 0 -height $h \
                    -font [Widget::cget $path -font]  \
                    -bg [Widget::cget $path -entrybg] \
                    -fg [Widget::cget $path -foreground]]
        } else {
            set listb  [ListBox $shell.listb \
                    -relief flat -borderwidth 0 -highlightthickness 0 \
                    -selectmode single -selectfill 1 -autofocus 0 -height $h \
                    -font [Widget::cget $path -font]  \
                    -bg [Widget::cget $path -entrybg] \
                    -fg [Widget::cget $path -foreground] \
................................................................................
    } else {
        if {[Widget::theme]} {
            set listb  [listbox $shell.listb \
                    -relief flat -borderwidth 0 -highlightthickness 0 \
                    -exportselection false \
                    -font	[Widget::cget $path -font]  \
                    -height $h \
                    -bg [Widget::cget $path -entrybg] \
                    -fg [Widget::cget $path -foreground] \
                    -listvariable [Widget::varForOption $path -values]]
        } else {
            set listb  [listbox $shell.listb \
                    -relief flat -borderwidth 0 -highlightthickness 0 \
                    -exportselection false \
                    -font	[Widget::cget $path -font]  \
                    -height $h \
................................................................................

    set listb $shell.listb
    destroy $shell.sw
    set sw [ScrolledWindow $shell.sw -managed 1 -size $sbwidth -ipad 0]
    $listb configure \
            -height $h \
            -font   [Widget::cget $path -font] \
            -bg     [Widget::cget $path -entrybg] \
            -fg     [Widget::cget $path -foreground]
    if {![Widget::theme]} {
        $listb configure \

                -selectbackground [Widget::cget $path -selectbackground] \
                -selectforeground [Widget::cget $path -selectforeground]
    }
    pack $sw -fill both -expand yes
    $sw setwidget $listb
    raise $listb
}






|







 







>
|
>
>
>




>







 







>
>
>
>
>
>
>
>
>







 







|







 







|
<







 







|
<


>







6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
...
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
...
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
...
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
...
546
547
548
549
550
551
552
553

554
555
556
557
558
559
560
...
618
619
620
621
622
623
624
625

626
627
628
629
630
631
632
633
634
635
#  Index of commands:
#     - ComboBox::create
#     - ComboBox::configure
#     - ComboBox::cget
#     - ComboBox::setvalue
#     - ComboBox::getvalue
#     - ComboBox::clearvalue
#     - ComboBox::getentry
#     - ComboBox::_create_popup
#     - ComboBox::_mapliste
#     - ComboBox::_unmapliste
#     - ComboBox::_select
#     - ComboBox::_modify_value
# ----------------------------------------------------------------------------

................................................................................
        Entry::configure $entry -takefocus 1
    }

    # if the dropdown listbox is shown, simply force the actual entry
    #  colors into it. If it is not shown, the next time the dropdown
    #  is shown it'll get the actual colors anyway
    if {[winfo exists $path.shell.listb]} {
	if {[Widget::theme]} {
	    $path.shell.listb configure \
		-fg [_getfg $path]
	} else {
	    $path.shell.listb configure \
		-bg [Widget::cget $path -entrybg] \
		-fg [Widget::cget $path -foreground] \
		-selectbackground [Widget::cget $path -selectbackground] \
		-selectforeground [Widget::cget $path -selectforeground]
	}
    }

    return $res
}


# ----------------------------------------------------------------------------
................................................................................
# ----------------------------------------------------------------------------
#  Command ComboBox::getentry
# ----------------------------------------------------------------------------
proc ComboBox::getentry { path } {
    return $path.e
}

proc ComboBox::_getfg {path} {
    # First try to retrieve option
    set fg [Widget::cget $path -foreground];
    if { 0 == [string length $fg] && [Widget::theme] } {
	# fall back to style settings when not configured for widget
	return [::ttk::style lookup TEntry -foreground];
    }
    return $fg;
}
# ----------------------------------------------------------------------------
#  Command ComboBox::_create_popup
# ----------------------------------------------------------------------------
proc ComboBox::_create_popup { path } {
    set shell $path.shell

    if {[winfo exists $shell]} { return }
................................................................................
    if {$bw} {
        if {[Widget::theme]} {
            set listb  [ListBox $shell.listb \
                    -relief flat -borderwidth 0 -highlightthickness 0 \
                    -selectmode single -selectfill 1 -autofocus 0 -height $h \
                    -font [Widget::cget $path -font]  \
                    -bg [Widget::cget $path -entrybg] \
                    -fg [_getfg $path]]
        } else {
            set listb  [ListBox $shell.listb \
                    -relief flat -borderwidth 0 -highlightthickness 0 \
                    -selectmode single -selectfill 1 -autofocus 0 -height $h \
                    -font [Widget::cget $path -font]  \
                    -bg [Widget::cget $path -entrybg] \
                    -fg [Widget::cget $path -foreground] \
................................................................................
    } else {
        if {[Widget::theme]} {
            set listb  [listbox $shell.listb \
                    -relief flat -borderwidth 0 -highlightthickness 0 \
                    -exportselection false \
                    -font	[Widget::cget $path -font]  \
                    -height $h \
                    -fg [_getfg $path] \

                    -listvariable [Widget::varForOption $path -values]]
        } else {
            set listb  [listbox $shell.listb \
                    -relief flat -borderwidth 0 -highlightthickness 0 \
                    -exportselection false \
                    -font	[Widget::cget $path -font]  \
                    -height $h \
................................................................................

    set listb $shell.listb
    destroy $shell.sw
    set sw [ScrolledWindow $shell.sw -managed 1 -size $sbwidth -ipad 0]
    $listb configure \
            -height $h \
            -font   [Widget::cget $path -font] \
            -fg     [_getfg $path]

    if {![Widget::theme]} {
        $listb configure \
                -bg [Widget::cget $path -entrybg] \
                -selectbackground [Widget::cget $path -selectbackground] \
                -selectforeground [Widget::cget $path -selectforeground]
    }
    pack $sw -fill both -expand yes
    $sw setwidget $listb
    raise $listb
}