Bwidget Source Code
Check-in [2c3d9d4c82]
Not logged in

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

Overview
Comment:* entry.tcl, BWMan/entry.tcl checkbox.tcl Themed mode: Invoking "configure" without arguments results in errors that non-ttk options are not present. Removed Entry options: -background -foreground -relief -borderwidth -fg -bg -bd. Reported by Wolfgang S. Kechel [Bug 3513263] * entry.tcl mapped entry option -state to ttk::entry state in themed mode to make state change visible.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | bwidget
Files: files | file ages | folders
SHA1: 2c3d9d4c82e06641eefc4f0d2a0658ba5823dda2
User & Date: oehhar 2012-04-02 09:53:41.000
Context
2012-04-12
12:46
listbox.tcl ListBox::selection Only redraw if selection changed. Patch by Wolfgang S. Kechel [Bug 3517145] check-in: 8d829980cc user: oehhar tags: bwidget
2012-04-02
09:53
* entry.tcl, BWMan/entry.tcl checkbox.tcl Themed mode: Invoking "configure" without arguments results in errors that non-ttk options are not present. Removed Entry options: -background -foreground -relief -borderwidth -fg -bg -bd. Reported by Wolfgang S. Kechel [Bug 3513263] * entry.tcl mapped entry option -state to ttk::entry state in themed mode to make state change visible. check-in: 2c3d9d4c82 user: oehhar tags: bwidget
2012-03-06
14:16
BWMan/ListBox.html documented options -selectfill and -autofocus as read-only. Reported by Wolfgang S. Kechel [Bug 3497592] check-in: c781f11f40 user: oehhar tags: bwidget
Changes
Unified Diff Ignore Whitespace Patch
Changes to BWman/Entry.html.
1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
<HTML>
<HEAD><TITLE>Entry</TITLE></HEAD>
<BODY BGCOLOR=white>
<DL><DT><I><A HREF="#descr">NAME</A></I></DT>
<DD><B>Entry</B>
 - Entry widget with <B>state</B> option, dynamic help and drag and drop facilities
</DD></DL>
<DL>
<DT><I>CREATION</I></DT>
<DD><A HREF="#descr"><B>Entry</B></A> <I>pathName</I> ?<I>option value...</I>?</DD>
</DL>
<DL>
<DT><I>STANDARD OPTIONS</I></DT>

<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-background">-background or -bg</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-borderwidth">-borderwidth or -bd</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-disabledbackground">-disabledbackground</A></TD>













>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<HTML>
<HEAD><TITLE>Entry</TITLE></HEAD>
<BODY BGCOLOR=white>
<DL><DT><I><A HREF="#descr">NAME</A></I></DT>
<DD><B>Entry</B>
 - Entry widget with <B>state</B> option, dynamic help and drag and drop facilities
</DD></DL>
<DL>
<DT><I>CREATION</I></DT>
<DD><A HREF="#descr"><B>Entry</B></A> <I>pathName</I> ?<I>option value...</I>?</DD>
</DL>
<DL>
<DT><I>STANDARD OPTIONS</I></DT>
<DT><I>Not themed</I></DT>
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-background">-background or -bg</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-borderwidth">-borderwidth or -bd</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-disabledbackground">-disabledbackground</A></TD>
48
49
50
51
52
53
54
























55
56
57
58
59
60
61
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-relief">-relief</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-selectbackground">-selectbackground</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-selectborderwidth">-selectborderwidth</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-selectforeground">-selectforeground</A></TD>
</TR>
























<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-takefocus">-takefocus</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-text">-text</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-textvariable">-textvariable</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-xscrollcommand">-xscrollcommand</A></TD>







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







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-relief">-relief</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-selectbackground">-selectbackground</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-selectborderwidth">-selectborderwidth</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-selectforeground">-selectforeground</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-takefocus">-takefocus</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-text">-text</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-textvariable">-textvariable</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-xscrollcommand">-xscrollcommand</A></TD>
</TABLE></DD>
</DL>
<DL>
<DT><I>Themed</I></DT>
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-exportselection">-exportselection</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-font">-font</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-insertofftime">-insertofftime</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-insertontime">-insertontime</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-insertwidth">-insertwidth</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-justify">-justify</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-takefocus">-takefocus</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-text">-text</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-textvariable">-textvariable</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-xscrollcommand">-xscrollcommand</A></TD>
Changes to ChangeLog.











1
2
3
4
5
6
7











2012-03-06 Harald Oehlmann <[email protected]>

	* BWMan/ListBox.html documented options -selectfill and
	-autofocus as read-only. Reported by Wolfgang S. Kechel
	[Bug 3497592]

2011-11-14 Harald Oehlmann <[email protected]>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2012-04-02 Harald Oehlmann <[email protected]>

	* entry.tcl, BWMan/entry.tcl checkbox.tcl Themed mode:
	Invoking "configure" without arguments results in errors
	that non-ttk options are not present.
	Removed Entry options: -background -foreground -relief
	-borderwidth -fg -bg -bd. Reported by Wolfgang S. Kechel
	[Bug 3513263]
	* entry.tcl mapped entry option -state to ttk::entry
	state in themed mode to make state change visible.

2012-03-06 Harald Oehlmann <[email protected]>

	* BWMan/ListBox.html documented options -selectfill and
	-autofocus as read-only. Reported by Wolfgang S. Kechel
	[Bug 3497592]

2011-11-14 Harald Oehlmann <[email protected]>
Changes to combobox.tcl.
1
2
3
4
5
6
7
8
9
10
11
# ----------------------------------------------------------------------------
#  combobox.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: combobox.tcl,v 1.42.2.2 2011/03/02 13:11:12 oehhar Exp $
# ----------------------------------------------------------------------------
#  Index of commands:
#     - ComboBox::create
#     - ComboBox::configure
#     - ComboBox::cget
#     - ComboBox::setvalue
#     - ComboBox::getvalue



|







1
2
3
4
5
6
7
8
9
10
11
# ----------------------------------------------------------------------------
#  combobox.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: combobox.tcl,v 1.42.2.3 2012/04/02 09:53:41 oehhar Exp $
# ----------------------------------------------------------------------------
#  Index of commands:
#     - ComboBox::create
#     - ComboBox::configure
#     - ComboBox::cget
#     - ComboBox::setvalue
#     - ComboBox::getvalue
23
24
25
26
27
28
29



30
31
32

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

49




50

51
52
53
54
55
56
57
namespace eval ComboBox {
    Widget::define ComboBox combobox ArrowButton Entry ListBox

    Widget::tkinclude ComboBox frame :cmd \
	include {-relief -borderwidth -bd -background} \
	initialize {-relief sunken -borderwidth 2}




    Widget::bwinclude ComboBox Entry .e \
	remove {-relief -bd -borderwidth -bg} \
	rename {-background -entrybg}


    Widget::declare ComboBox {
	{-height       TkResource 0    0 listbox}
	{-values       String	  ""   0}
	{-images       String	  ""   0}
	{-indents      String	  ""   0}
	{-modifycmd    String	  ""   0}
	{-postcommand  String	  ""   0}
	{-expand       Enum	  none 0 {none tab}}
	{-autocomplete Boolean	  0    0}
        {-autopost     Boolean    0    0}
        {-bwlistbox    Boolean    0    0}
        {-listboxwidth Int        0    0}
        {-hottrack     Boolean    0    0}
    }


    Widget::addmap ComboBox ArrowButton .a {




	-background {} -foreground {} -disabledforeground {} -state {}

    }

    Widget::syncoptions ComboBox Entry .e {-text {}}

    ::bind BwComboBox <FocusIn> [list after idle {BWidget::refocus %W %W.e}]
    ::bind BwComboBox <Destroy> [list ComboBox::_destroy %W]








>
>
>
|
|
|
>
















>
|
>
>
>
>
|
>







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
namespace eval ComboBox {
    Widget::define ComboBox combobox ArrowButton Entry ListBox

    Widget::tkinclude ComboBox frame :cmd \
	include {-relief -borderwidth -bd -background} \
	initialize {-relief sunken -borderwidth 2}

    if {[Widget::theme]} {
	Widget::bwinclude ComboBox Entry .e
    } else {
	Widget::bwinclude ComboBox Entry .e \
	    remove {-relief -bd -borderwidth -bg} \
	    rename {-background -entrybg}
    }

    Widget::declare ComboBox {
	{-height       TkResource 0    0 listbox}
	{-values       String	  ""   0}
	{-images       String	  ""   0}
	{-indents      String	  ""   0}
	{-modifycmd    String	  ""   0}
	{-postcommand  String	  ""   0}
	{-expand       Enum	  none 0 {none tab}}
	{-autocomplete Boolean	  0    0}
        {-autopost     Boolean    0    0}
        {-bwlistbox    Boolean    0    0}
        {-listboxwidth Int        0    0}
        {-hottrack     Boolean    0    0}
    }

    if {[Widget::theme]} {
	Widget::addmap ComboBox ArrowButton .a {
	    -background {} -state {}
	}
    } else {
	Widget::addmap ComboBox ArrowButton .a {
	    -background {} -foreground {} -disabledforeground {} -state {}
	}
    }

    Widget::syncoptions ComboBox Entry .e {-text {}}

    ::bind BwComboBox <FocusIn> [list after idle {BWidget::refocus %W %W.e}]
    ::bind BwComboBox <Destroy> [list ComboBox::_destroy %W]

Changes to entry.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24




25
26
27
28

29
30
31
32
33
34
35
36





37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

53
54
55
56
57
58
59
# ------------------------------------------------------------------------------
#  entry.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: entry.tcl,v 1.22.2.1 2011/02/14 16:56:09 oehhar Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - Entry::create
#     - Entry::configure
#     - Entry::cget
#     - Entry::_destroy
#     - Entry::_init_drag_cmd
#     - Entry::_end_drag_cmd
#     - Entry::_drop_cmd
#     - Entry::_over_cmd
#     - Entry::_auto_scroll
#     - Entry::_scroll
# ------------------------------------------------------------------------------

namespace eval Entry {
    Widget::define Entry entry DragSite DropSite DynamicHelp

    # Note:  -textvariable is pulled off of the tk entry and put onto the
    # BW Entry so that we avoid the TkResource test for it, which screws up
    # the existance/non-existance bits of the -textvariable.




    Widget::tkinclude Entry entry :cmd \
    	remove { -state -background -foreground -textvariable
    		 -disabledforeground -disabledbackground }


    set declare [list \
	    [list -background   TkResource  ""	   0  entry] \
	    [list -foreground   TkResource  ""	   0  entry] \
	    [list -state        Enum        normal 0  [list normal disabled]] \
	    [list -text         String      ""	   0] \
	    [list -textvariable String      ""     0] \
	    [list -editable     Boolean     1      0] \
	    [list -command      String      ""     0] \





	    [list -relief       TkResource  ""     0  entry] \
	    [list -borderwidth  TkResource  ""     0  entry] \
	    [list -fg           Synonym     -foreground] \
	    [list -bg           Synonym     -background] \
	    [list -bd           Synonym     -borderwidth] \
	]

    if {![package vsatisfies [package provide Tk] 8.4]} {
	## If we're not running version 8.4 or higher, get our
	## disabled resources from the button widget.
	lappend declare [list -disabledforeground TkResource "" 0 button]
	lappend declare [list -disabledbackground TkResource "" 0 \
							{button -background}]
    } else {
	lappend declare [list -disabledforeground TkResource "" 0 entry]
	lappend declare [list -disabledbackground TkResource "" 0 entry]

    }

    Widget::declare Entry $declare
    Widget::addmap Entry "" :cmd { -textvariable {} }

    DynamicHelp::include Entry balloon
    DragSite::include    Entry "" 3



|




















>
>
>
>
|
|
|
|
>

<
<





>
>
>
>
>
|
|
|
|
|
|
<
|
|
|
|
|
|
|
|
|
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34


35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# ------------------------------------------------------------------------------
#  entry.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: entry.tcl,v 1.22.2.2 2012/04/02 09:53:41 oehhar Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - Entry::create
#     - Entry::configure
#     - Entry::cget
#     - Entry::_destroy
#     - Entry::_init_drag_cmd
#     - Entry::_end_drag_cmd
#     - Entry::_drop_cmd
#     - Entry::_over_cmd
#     - Entry::_auto_scroll
#     - Entry::_scroll
# ------------------------------------------------------------------------------

namespace eval Entry {
    Widget::define Entry entry DragSite DropSite DynamicHelp

    # Note:  -textvariable is pulled off of the tk entry and put onto the
    # BW Entry so that we avoid the TkResource test for it, which screws up
    # the existance/non-existance bits of the -textvariable.
    if {[Widget::theme]} {
	Widget::tkinclude Entry ttk::entry :cmd \
	    remove { -state -textvariable }
    } else {
	Widget::tkinclude Entry entry :cmd \
	    remove { -state -background -foreground -textvariable
		     -disabledforeground -disabledbackground }
    }

    set declare [list \


	    [list -state        Enum        normal 0  [list normal disabled]] \
	    [list -text         String      ""	   0] \
	    [list -textvariable String      ""     0] \
	    [list -editable     Boolean     1      0] \
	    [list -command      String      ""     0] \
	]
    if {![Widget::theme]} {
	lappend declare \
		[list -background   TkResource  ""	   0  entry] \
		[list -foreground   TkResource  ""	   0  entry] \
		[list -relief       TkResource  ""     0  entry] \
		[list -borderwidth  TkResource  ""     0  entry] \
		[list -fg           Synonym     -foreground] \
		[list -bg           Synonym     -background] \
		[list -bd           Synonym     -borderwidth]


	if {![package vsatisfies [package provide Tk] 8.4]} {
	    ## If we're not running version 8.4 or higher, get our
	    ## disabled resources from the button widget.
	    lappend declare [list -disabledforeground TkResource "" 0 button]
	    lappend declare [list -disabledbackground TkResource "" 0 \
							    {button -background}]
	} else {
	    lappend declare [list -disabledforeground TkResource "" 0 entry]
	    lappend declare [list -disabledbackground TkResource "" 0 entry]
	}
    }

    Widget::declare Entry $declare
    Widget::addmap Entry "" :cmd { -textvariable {} }

    DynamicHelp::include Entry balloon
    DragSite::include    Entry "" 3
122
123
124
125
126
127
128



129
130
131

132

133
134
135

136
137
138
139
140
141
142
            $path configure -takefocus 0 -insertontime 0
        }
    }
    if { $editable == 0 } {
        $path configure -cursor left_ptr
    }
    if { [string equal $state "disabled"] } {



        $path configure \
            -foreground [Widget::getMegawidgetOption $path -disabledforeground] \
            -background [Widget::getMegawidgetOption $path -disabledbackground]

    } else {

	$path configure \
                -foreground [Widget::getMegawidgetOption $path -foreground] \
                -background [Widget::getMegawidgetOption $path -background]

	bindtags $path [linsert [bindtags $path] 2 BwEditableEntry]
    }
    if { [string length $text] } {
	set varName [$path cget -textvariable]
	if { ![string equal $varName ""] } {
	    uplevel \#0 [list set $varName [Widget::cget $path -text]]
	} else {







>
>
>
|
|
|
>

>
|
|
|
>







130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
            $path configure -takefocus 0 -insertontime 0
        }
    }
    if { $editable == 0 } {
        $path configure -cursor left_ptr
    }
    if { [string equal $state "disabled"] } {
        if {[Widget::theme]} {
	    $path state disabled
	} else {
	    $path configure \
		-foreground [Widget::getMegawidgetOption $path -disabledforeground] \
		-background [Widget::getMegawidgetOption $path -disabledbackground]
	}
    } else {
	if {![Widget::theme]} {
	    $path configure \
		    -foreground [Widget::getMegawidgetOption $path -foreground] \
		    -background [Widget::getMegawidgetOption $path -background]
	}
	bindtags $path [linsert [bindtags $path] 2 BwEditableEntry]
    }
    if { [string length $text] } {
	set varName [$path cget -textvariable]
	if { ![string equal $varName ""] } {
	    uplevel \#0 [list set $varName [Widget::cget $path -text]]
	} else {
166
167
168
169
170
171
172




173
174
175

176
177
178
179
180
181
182
    # Cheat by setting the -text value to the current contents of the entry
    # This might be better hidden behind a function in ::Widget.
    set Widget::Entry::${path}:opt(-text) [$path:cmd get]

    set res [Widget::configure $path $args]

    # Extract the modified bits that we are interested in.




    set vars [list chstate cheditable chfg chdfg chbg chdbg chtext]
    set opts [list -state -editable -foreground -disabledforeground \
                -background -disabledbackground -text]

    foreach $vars [eval [linsert $opts 0 Widget::hasChangedX $path]] { break }

    if { $chstate || $cheditable } {
	set state [Widget::getMegawidgetOption $path -state]
	set editable [Widget::getMegawidgetOption $path -editable]
        set btags [bindtags $path]
        if { $editable && [string equal $state "normal"] } {







>
>
>
>
|
|
|
>







180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
    # Cheat by setting the -text value to the current contents of the entry
    # This might be better hidden behind a function in ::Widget.
    set Widget::Entry::${path}:opt(-text) [$path:cmd get]

    set res [Widget::configure $path $args]

    # Extract the modified bits that we are interested in.
    if {[Widget::theme]} {
	set vars [list chstate cheditable chtext]
	set opts [list -state -editable -text]
    } else {
	set vars [list chstate cheditable chfg chdfg chbg chdbg chtext]
	set opts [list -state -editable -foreground -disabledforeground \
		    -background -disabledbackground -text]
    }
    foreach $vars [eval [linsert $opts 0 Widget::hasChangedX $path]] { break }

    if { $chstate || $cheditable } {
	set state [Widget::getMegawidgetOption $path -state]
	set editable [Widget::getMegawidgetOption $path -editable]
        set btags [bindtags $path]
        if { $editable && [string equal $state "normal"] } {
201
202
203
204
205
206
207








208
209
210
211
212
213
214
            }
            if { [string equal [focus] $path] } {
                focus .
            }
        }
    }









    if { ![Widget::theme] && ($chstate || $chfg || $chdfg || $chbg || $chdbg) } {
	set state [Widget::getMegawidgetOption $path -state]
        if { [string equal $state "disabled"] } {
            $path:cmd configure \
                -fg [Widget::cget $path -disabledforeground] \
                -bg [Widget::cget $path -disabledbackground]
        } else {







>
>
>
>
>
>
>
>







220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
            }
            if { [string equal [focus] $path] } {
                focus .
            }
        }
    }

    if { [Widget::theme] && $chstate } {
	set state [Widget::getMegawidgetOption $path -state]
        if { [string equal $state "disabled"] } {
            $path:cmd state disabled
        } else {
            $path:cmd state !disabled
        }
    }
    if { ![Widget::theme] && ($chstate || $chfg || $chdfg || $chbg || $chdbg) } {
	set state [Widget::getMegawidgetOption $path -state]
        if { [string equal $state "disabled"] } {
            $path:cmd configure \
                -fg [Widget::cget $path -disabledforeground] \
                -bg [Widget::cget $path -disabledbackground]
        } else {