Bwidget Source Code
Check-in [73bdde118f]
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:Themed ComboBox color specifications are honored [6c6704e40f]
Timelines: family | ancestors | descendants | both | bwidget
Files: files | file ages | folders
SHA1: 73bdde118f8eb8d39db2049327ae9f6a24e4a598
User & Date: oehhar 2013-10-15 19:06:44
References
2013-10-15
19:08 Closed ticket [6c6704e40f]: Themed Combobox shows listbox white on white when colors given plus 8 other changes artifact: 46cc57c7de user: oehhar
Context
2013-10-17
12:55
Remove temporary widget[6cd041bcc1] check-in: 2ff16995c7 user: oehhar tags: bwidget
2013-10-15
19:06
Themed ComboBox color specifications are honored [6c6704e40f] check-in: 73bdde118f user: oehhar tags: bwidget
2013-10-14
15:59
ScrolledWindow: raise scrolled window if below in window hierarchy [6632134ce9] check-in: 10c00fc4fb user: oehhar tags: bwidget
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.

1




2
3
4
5
6
7
8
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 [6632134ce9]
	
	listbox.tcl: Update on option -deltay added.
	Set x0 to 2 to make highlight work and look nice for
|
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
2013-10-14 Harald Oehlmann <[email protected]>
	combobox.tcl: Themed ComboBox color specifications
	are honored. By Wolfgang S. Kechel. Ticket [6c6704e40f]

2013-10-14 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 [6632134ce9]
	
	listbox.tcl: Update on option -deltay added.
	Set x0 to 2 to make highlight work and look nice for

Changes to combobox.tcl.

295
296
297
298
299
300
301
302
303

304
305
306
307
308
309
310
311
312
313
314
315
...
467
468
469
470
471
472
473














474
475
476
477
478
479
480
...
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
...
546
547
548
549
550
551
552

553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
...
618
619
620
621
622
623
624

625
626
627
628
629
630
631
632
633
634
635
        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
}
................................................................................
    # 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

................................................................................
    set sw [ScrolledWindow $shell.sw -managed 1 -size $sbwidth -ipad 0]

    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] \
                    -selectbackground [Widget::cget $path -selectbackground] \
                    -selectforeground [Widget::cget $path -selectforeground]]
        }

        set values [Widget::cget $path -values]
        set images [Widget::cget $path -images]
        foreach value $values image $images {
................................................................................
    } 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 \
                    -bg [Widget::cget $path -entrybg] \
                    -fg [Widget::cget $path -foreground] \
                    -selectbackground [Widget::cget $path -selectbackground] \
                    -selectforeground [Widget::cget $path -selectforeground] \
                    -listvariable [Widget::varForOption $path -values]]
        }
        ::bind $listb <ButtonRelease-1> [list ComboBox::_select $path @%x,%y]

        if {[Widget::cget $path -hottrack]} {
................................................................................

    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
}






<
|
>
|
|

<
<







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|
|






|
|







 







>








|
|







 







>



<







295
296
297
298
299
300
301

302
303
304
305
306


307
308
309
310
311
312
313
...
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
...
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
...
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
...
631
632
633
634
635
636
637
638
639
640
641

642
643
644
645
646
647
648
        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 [_getbg $path] \
	    -fg [_getfg $path]
	if {![Widget::theme]} {
	    $path.shell.listb configure \


		-selectbackground [Widget::cget $path -selectbackground] \
		-selectforeground [Widget::cget $path -selectforeground]
	}
    }

    return $res
}
................................................................................
    # 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;
}
proc ComboBox::_getbg {path} {
    if {[Widget::theme]} {
	# First try to retrieve option
	set bg [Widget::cget $path -background];
	if {0 == [string length $bg]} {
	    # fall back to style settings when not configured for widget
	    return [::ttk::style lookup TEntry -backround];
	}
    } else {
	# fetch the entrybg resource value
	set bg [Widget::cget $path -entrybg]
    }
    return $bg;
}
# ----------------------------------------------------------------------------
#  Command ComboBox::_create_popup
# ----------------------------------------------------------------------------
proc ComboBox::_create_popup { path } {
    set shell $path.shell

................................................................................
    set sw [ScrolledWindow $shell.sw -managed 1 -size $sbwidth -ipad 0]

    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 [_getbg $path] \
                    -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 [_getbg $path] \
                    -fg [_getfg $path] \
                    -selectbackground [Widget::cget $path -selectbackground] \
                    -selectforeground [Widget::cget $path -selectforeground]]
        }

        set values [Widget::cget $path -values]
        set images [Widget::cget $path -images]
        foreach value $values image $images {
................................................................................
    } 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 [_getbg $path] \
                    -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 \
                    -bg [_getbg $path] \
                    -fg [_getfg $path] \
                    -selectbackground [Widget::cget $path -selectbackground] \
                    -selectforeground [Widget::cget $path -selectforeground] \
                    -listvariable [Widget::varForOption $path -values]]
        }
        ::bind $listb <ButtonRelease-1> [list ComboBox::_select $path @%x,%y]

        if {[Widget::cget $path -hottrack]} {
................................................................................

    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     [_getbg $path] \
            -fg     [_getfg $path]
    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
}